From: Andrzej Hajda <a.hajda@samsung.com>
To: linux-wireless@vger.kernel.org (open list:NFC SUBSYSTEM)
Cc: Andrzej Hajda <a.hajda@samsung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Lauro Ramos Venancio <lauro.venancio@openbossa.org>,
Aloisio Almeida Jr <aloisio.almeida@openbossa.org>,
Samuel Ortiz <sameo@linux.intel.com>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH v2] NFC: fdp: fix handling return value of fdp_nci_create_conn
Date: Thu, 10 Dec 2015 09:35:03 +0100 [thread overview]
Message-ID: <1449736503-6615-1-git-send-email-a.hajda@samsung.com> (raw)
In-Reply-To: <1449733982-29120-1-git-send-email-a.hajda@samsung.com>
The function can return negative values, so its result should
be assigned to signed variable.
The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
v2: fixed typo in goto instruction
drivers/nfc/fdp/fdp.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c
index ccb07a1..4dfd1ef 100644
--- a/drivers/nfc/fdp/fdp.c
+++ b/drivers/nfc/fdp/fdp.c
@@ -368,11 +368,10 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev)
goto out;
/* Patch data connection creation */
- conn_id = fdp_nci_create_conn(ndev);
- if (conn_id < 0) {
- r = conn_id;
+ r = fdp_nci_create_conn(ndev);
+ if (r < 0)
goto out;
- }
+ conn_id = r;
/* Send the patch over the data connection */
r = fdp_nci_send_patch(ndev, conn_id, NCI_PATCH_TYPE_OTP);
@@ -439,11 +438,10 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev)
goto out;
/* Patch data connection creation */
- conn_id = fdp_nci_create_conn(ndev);
- if (conn_id < 0) {
- r = conn_id;
+ r = fdp_nci_create_conn(ndev);
+ if (r < 0)
goto out;
- }
+ conn_id = r;
/* Send the patch over the data connection */
r = fdp_nci_send_patch(ndev, conn_id, NCI_PATCH_TYPE_RAM);
--
1.9.1
prev parent reply other threads:[~2015-12-10 8:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-10 7:53 [PATCH] " Andrzej Hajda
2015-12-10 8:35 ` Andrzej Hajda [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1449736503-6615-1-git-send-email-a.hajda@samsung.com \
--to=a.hajda@samsung.com \
--cc=aloisio.almeida@openbossa.org \
--cc=b.zolnierkie@samsung.com \
--cc=lauro.venancio@openbossa.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=sameo@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®