From 81859ab8779567af491fbf83ea628cdf09188d90 Mon Sep 17 00:00:00 2001
From: Christophe Ricard <christophe.ricard@gmail.com>
Date: Sat, 6 Jun 2015 13:16:39 +0200
Subject: NFC: nci: Add NCI_RESET return code check before setup

setup was executed in any case, even if NCI_RESET failed.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
---
 net/nfc/nci/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'net/nfc/nci')

diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 56d57c93ea1a..b900e6a2a284 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -347,8 +347,9 @@ static int nci_open_device(struct nci_dev *ndev)
 	rc = __nci_request(ndev, nci_reset_req, 0,
 			   msecs_to_jiffies(NCI_RESET_TIMEOUT));
 
-	if (ndev->ops->setup)
-		ndev->ops->setup(ndev);
+	if (!rc && ndev->ops->setup) {
+		rc = ndev->ops->setup(ndev);
+	}
 
 	if (!rc) {
 		rc = __nci_request(ndev, nci_init_req, 0,
-- 
cgit v1.2.3