From: Julia Lawall <julia@diku.dk>
To: Jonathan Woithe <jwoithe@physics.adelaide.edu.au>,
Matthew Garrett <mjg@redhat.com>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH 15/16] drivers/platform/x86: Use available error codes
Date: Mon, 16 Aug 2010 18:28:52 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.64.1008161828350.19313@ask.diku.dk> (raw)
From: Julia Lawall <julia@diku.dk>
An error code is stored in the variable error, but it is the variable
result that is returned instead. So store the error code in result.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
local idexpression x;
constant C;
@@
if (...) { ...
x = -C
... when != x
(
return <+...x...+>;
|
return NULL;
|
return;
|
* return ...;
)
}
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
This changes the semantics and has not been tested. In each case, error is
also assigned to the result of a function call. Perhpas that should be
changed to result as well, and error should be eliminated.
drivers/platform/x86/fujitsu-laptop.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index f44cd26..e7d2259 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -668,7 +668,7 @@ static int acpi_fujitsu_add(struct acpi_device *device)
fujitsu->input = input = input_allocate_device();
if (!input) {
- error = -ENOMEM;
+ result = -ENOMEM;
goto err_stop;
}
@@ -833,7 +833,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
fujitsu_hotkey->input = input = input_allocate_device();
if (!input) {
- error = -ENOMEM;
+ result = -ENOMEM;
goto err_free_fifo;
}
next reply other threads:[~2010-08-16 16:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-16 16:28 Julia Lawall [this message]
2010-08-16 17:11 ` Jonathan Woithe
2010-08-16 20:43 ` Julia Lawall
2010-08-16 18:13 ` Dan Carpenter
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=Pine.LNX.4.64.1008161828350.19313@ask.diku.dk \
--to=julia@diku.dk \
--cc=jwoithe@physics.adelaide.edu.au \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mjg@redhat.com \
--cc=platform-driver-x86@vger.kernel.org \
/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®