* [PATCH] staging: iio: industrialio-core: Fix compiler warning
@ 2011-08-22 10:08 Maxin B. John
2011-08-22 11:37 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Maxin B. John @ 2011-08-22 10:08 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Jonathan Cameron, Michael Hennerich, Manuel Stahl, Bryan Freed,
linux-iio, devel, linux-kernel
drivers/staging/iio/industrialio-core.c: In function
'iio_device_add_event_sysfs':
drivers/staging/iio/industrialio-core.c:914: warning: 'mask' may be
used uninitialized in this function
Signed-off-by: Maxin B. John <maxin.john@gmail.com>
---
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index 19819e7..83b5953 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -911,7 +911,7 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info,
struct iio_chan_spec const *chan)
{
- int ret = 0, i, mask;
+ int ret = 0, i, mask = 0;
char *postfix;
if (!chan->event_mask)
return 0;
@@ -944,6 +944,8 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info,
break;
default:
printk(KERN_INFO "currently unhandled type of event\n");
+ ret = -EINVAL;
+ goto error_ret;
}
ret = __iio_add_chan_devattr(postfix,
NULL,
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: iio: industrialio-core: Fix compiler warning
2011-08-22 10:08 [PATCH] staging: iio: industrialio-core: Fix compiler warning Maxin B. John
@ 2011-08-22 11:37 ` Jonathan Cameron
2011-08-22 11:44 ` Maxin B John
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2011-08-22 11:37 UTC (permalink / raw)
To: Maxin B. John
Cc: Greg Kroah-Hartman, Michael Hennerich, Manuel Stahl, Bryan Freed,
linux-iio, devel, linux-kernel
On 08/22/11 11:08, Maxin B. John wrote:
> drivers/staging/iio/industrialio-core.c: In function
> 'iio_device_add_event_sysfs':
> drivers/staging/iio/industrialio-core.c:914: warning: 'mask' may be
> used uninitialized in this function
Thanks for the patch. It's actually a driver bug if this occurs.
We could have had a WARN_ON to let userspace know about the bug and
indeed taken the error route you suggest but
the relevant code has actually undergone a rewrite anyway so the
bit you are fixing doesn't exist any more anyway.
See http://git.kernel.org/?p=linux/kernel/git/jic23/iio-blue.git;a=summary
For our current dev tree (eats babies and includes all sorts of stuff
that hasn't been reviewed yet - so beware).
> Signed-off-by: Maxin B. John <maxin.john@gmail.com>
> ---
> diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
> index 19819e7..83b5953 100644
> --- a/drivers/staging/iio/industrialio-core.c
> +++ b/drivers/staging/iio/industrialio-core.c
> @@ -911,7 +911,7 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info,
> struct iio_chan_spec const *chan)
> {
>
> - int ret = 0, i, mask;
> + int ret = 0, i, mask = 0;
> char *postfix;
> if (!chan->event_mask)
> return 0;
> @@ -944,6 +944,8 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info,
> break;
> default:
> printk(KERN_INFO "currently unhandled type of event\n");
> + ret = -EINVAL;
> + goto error_ret;
> }
> ret = __iio_add_chan_devattr(postfix,
> NULL,
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: iio: industrialio-core: Fix compiler warning
2011-08-22 11:37 ` Jonathan Cameron
@ 2011-08-22 11:44 ` Maxin B John
0 siblings, 0 replies; 4+ messages in thread
From: Maxin B John @ 2011-08-22 11:44 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Greg Kroah-Hartman, Michael Hennerich, Manuel Stahl, Bryan Freed,
linux-iio, devel, linux-kernel
On Mon, Aug 22, 2011 at 2:37 PM, Jonathan Cameron <jic23@cam.ac.uk> wrote:
> On 08/22/11 11:08, Maxin B. John wrote:
>> drivers/staging/iio/industrialio-core.c: In function
>> 'iio_device_add_event_sysfs':
>> drivers/staging/iio/industrialio-core.c:914: warning: 'mask' may be
>> used uninitialized in this function
> Thanks for the patch. It's actually a driver bug if this occurs.
> We could have had a WARN_ON to let userspace know about the bug and
> indeed taken the error route you suggest but
> the relevant code has actually undergone a rewrite anyway so the
> bit you are fixing doesn't exist any more anyway.
Yes, That makes more sense.
> See http://git.kernel.org/?p=linux/kernel/git/jic23/iio-blue.git;a=summary
> For our current dev tree (eats babies and includes all sorts of stuff
> that hasn't been reviewed yet - so beware).
Thanks for sharing this (scary) info :)
Best Regards,
Maxin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: iio: industrialio-core: Fix compiler warning
@ 2011-08-22 11:44 ` Maxin B John
0 siblings, 0 replies; 4+ messages in thread
From: Maxin B John @ 2011-08-22 11:44 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Greg Kroah-Hartman, Michael Hennerich, Manuel Stahl, Bryan Freed,
linux-iio, devel, linux-kernel
On Mon, Aug 22, 2011 at 2:37 PM, Jonathan Cameron <jic23@cam.ac.uk> wrote:
> On 08/22/11 11:08, Maxin B. John wrote:
>> drivers/staging/iio/industrialio-core.c: In function
>> 'iio_device_add_event_sysfs':
>> drivers/staging/iio/industrialio-core.c:914: warning: 'mask' may be
>> used uninitialized in this function
> Thanks for the patch. =A0It's actually a driver bug if this occurs.
> We could have had a WARN_ON to let userspace know about the bug and
> indeed taken the error route you suggest but
> the relevant code has actually undergone a rewrite anyway so the
> bit you are fixing doesn't exist any more anyway.
Yes, That makes more sense.
> See http://git.kernel.org/?p=3Dlinux/kernel/git/jic23/iio-blue.git;a=3Dsu=
mmary
> For our current dev tree (eats babies and includes all sorts of stuff
> that hasn't been reviewed yet - so beware).
Thanks for sharing this (scary) info :)
Best Regards,
Maxin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-08-22 11:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-22 10:08 [PATCH] staging: iio: industrialio-core: Fix compiler warning Maxin B. John
2011-08-22 11:37 ` Jonathan Cameron
2011-08-22 11:44 ` Maxin B John
2011-08-22 11:44 ` Maxin B John
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.