All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] asus-wmi: fix error handling in store_sys_wmi()
@ 2015-11-10 22:18 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2015-11-10 22:18 UTC (permalink / raw)
  To: Corentin Chary
  Cc: Darren Hart, acpi4asus-user, platform-driver-x86, kernel-janitors

The asus_wmi_get_devstate_simple() returns 0-1 on success.  In theory
according to static checkers, it can return either -EIO or -ENODEV on
failure.  Currently the error handling code only handles -ENODEV and
-EIO is treated as success.  Let's make it handle the -EIO error as
well.

It's possible that it can't actually return -EIO and this patch is not
needed but in that case this patch is harmless and silences a static
checker warning so it's still worth it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index e3a7502..f96f7b8 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1682,7 +1682,7 @@ static ssize_t store_sys_wmi(struct asus_wmi *asus, int devid,
 	int rv, err, value;
 
 	value = asus_wmi_get_devstate_simple(asus, devid);
-	if (value = -ENODEV)	/* Check device presence */
+	if (value < 0)
 		return value;
 
 	rv = parse_arg(buf, count, &value);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [patch] asus-wmi: fix error handling in store_sys_wmi()
@ 2015-11-10 22:18 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2015-11-10 22:18 UTC (permalink / raw)
  To: Corentin Chary
  Cc: Darren Hart, acpi4asus-user, platform-driver-x86, kernel-janitors

The asus_wmi_get_devstate_simple() returns 0-1 on success.  In theory
according to static checkers, it can return either -EIO or -ENODEV on
failure.  Currently the error handling code only handles -ENODEV and
-EIO is treated as success.  Let's make it handle the -EIO error as
well.

It's possible that it can't actually return -EIO and this patch is not
needed but in that case this patch is harmless and silences a static
checker warning so it's still worth it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index e3a7502..f96f7b8 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1682,7 +1682,7 @@ static ssize_t store_sys_wmi(struct asus_wmi *asus, int devid,
 	int rv, err, value;
 
 	value = asus_wmi_get_devstate_simple(asus, devid);
-	if (value == -ENODEV)	/* Check device presence */
+	if (value < 0)
 		return value;
 
 	rv = parse_arg(buf, count, &value);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] asus-wmi: fix error handling in store_sys_wmi()
  2015-11-10 22:18 ` Dan Carpenter
@ 2015-11-11  6:22   ` Darren Hart
  -1 siblings, 0 replies; 4+ messages in thread
From: Darren Hart @ 2015-11-11  6:22 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Corentin Chary, acpi4asus-user, platform-driver-x86,
	kernel-janitors

On Wed, Nov 11, 2015 at 01:18:16AM +0300, Dan Carpenter wrote:
> The asus_wmi_get_devstate_simple() returns 0-1 on success.  In theory
> according to static checkers, it can return either -EIO or -ENODEV on
> failure.  Currently the error handling code only handles -ENODEV and
> -EIO is treated as success.  Let's make it handle the -EIO error as
> well.
> 
> It's possible that it can't actually return -EIO and this patch is not
> needed but in that case this patch is harmless and silences a static
> checker warning so it's still worth it.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thank you Dan, queued to testing.

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] asus-wmi: fix error handling in store_sys_wmi()
@ 2015-11-11  6:22   ` Darren Hart
  0 siblings, 0 replies; 4+ messages in thread
From: Darren Hart @ 2015-11-11  6:22 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Corentin Chary, acpi4asus-user, platform-driver-x86,
	kernel-janitors

On Wed, Nov 11, 2015 at 01:18:16AM +0300, Dan Carpenter wrote:
> The asus_wmi_get_devstate_simple() returns 0-1 on success.  In theory
> according to static checkers, it can return either -EIO or -ENODEV on
> failure.  Currently the error handling code only handles -ENODEV and
> -EIO is treated as success.  Let's make it handle the -EIO error as
> well.
> 
> It's possible that it can't actually return -EIO and this patch is not
> needed but in that case this patch is harmless and silences a static
> checker warning so it's still worth it.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thank you Dan, queued to testing.

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-11  6:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-10 22:18 [patch] asus-wmi: fix error handling in store_sys_wmi() Dan Carpenter
2015-11-10 22:18 ` Dan Carpenter
2015-11-11  6:22 ` Darren Hart
2015-11-11  6:22   ` Darren Hart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.