NFC: nci: Do not call post_setup when setup fails
authorRobert Dolca <robert.dolca@intel.com>
Thu, 22 Oct 2015 09:11:36 +0000 (12:11 +0300)
committerSamuel Ortiz <sameo@linux.intel.com>
Sun, 25 Oct 2015 18:11:58 +0000 (19:11 +0100)
The driver should know that it can continue with post setup where
setup left off. Being able to execute post_setup when setup fails
may force the developer to keep this state in the driver.

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
net/nfc/nci/core.c

index 090972033a15e2c745a4b2a3721892583b0825b9..5362d8f543e73b39c32c0d9a56009baf3f17ba0b 100644 (file)
@@ -402,9 +402,8 @@ static int nci_open_device(struct nci_dev *ndev)
                                   msecs_to_jiffies(NCI_INIT_TIMEOUT));
        }
 
-       if (ndev->ops->post_setup) {
+       if (!rc && ndev->ops->post_setup)
                rc = ndev->ops->post_setup(ndev);
-       }
 
        if (!rc) {
                rc = __nci_request(ndev, nci_init_complete_req, 0,