diff mbox

[5/8] NFC: NCI: Don't call setup if previous NCI request failed

Message ID 1424772112-27399-6-git-send-email-robert.dolca@intel.com (mailing list archive)
State Not Applicable
Delegated to: Kalle Valo
Headers show

Commit Message

Robert Dolca Feb. 24, 2015, 10:01 a.m. UTC
If the previous nci_request (NCI reset) failed the setup function
was being called anyway. It shouldn't be called if the reset failed.

The result of the setup function is taken into consideration. If it
fails the init should fail.

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
---
 net/nfc/nci/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Samuel Ortiz March 26, 2015, 12:29 a.m. UTC | #1
Hi Robert,

On Tue, Feb 24, 2015 at 12:01:49PM +0200, Robert Dolca wrote:
> If the previous nci_request (NCI reset) failed the setup function
> was being called anyway. It shouldn't be called if the reset failed.
> 
> The result of the setup function is taken into consideration. If it
> fails the init should fail.
> 
> Signed-off-by: Robert Dolca <robert.dolca@intel.com>
> ---
>  net/nfc/nci/core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
> index 1a449ac..d2e7adf 100644
> --- a/net/nfc/nci/core.c
> +++ b/net/nfc/nci/core.c
> @@ -365,8 +365,8 @@ 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);
That one makes sense.

Cheers,
Samuel.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 1a449ac..d2e7adf 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -365,8 +365,8 @@  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,