iio: Function iio_get_new_idr_val() return negative value if fails.
Subsystems (3)
PATCH 1/1 iio: Function iio_get_new_idr_val() return negative value if fails.
Function iio_get_new_idr_val() return negative value if fails. So, only error when ret < 0 in iio_device_register_eventset().
--- drivers/staging/iio/industrialio-core.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/staging/iio/industrialio-core.c +2 -1
@@ -536,6 +536,7 @@ static void iio_device_unregister_sysfs(struct iio_dev *dev_info)sysfs_remove_group (&dev_info->dev.kobj, dev_info->attrs); } +/* This function return negative value if fails. */ int iio_get_new_idr_val (struct idr *this_idr) {int ret;
@@ -659,7 +660,7 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)for (i =0 ; i < dev_info->num_interrupt_lines; i++) { dev_info->event_interfaces[i].owner = dev_info->driver_module; ret =iio_get_new_idr_val (&iio_event_idr); -if (ret) +if (ret <0 ) goto error_free_setup_ev_ints;else dev_info->event_interfaces[i].id = ret;
Signature · 1 line
1.6.0
Quoted 5 lines · sonic zhang
Function
iio_get_new_idr_val()return negative value if fails. So, only error when ret < 0 iniio_device_register_eventset().Signed-off-by Sonic Zhang <[email protected]>
Youch. I'm amazed that one hasn't caused more trouble! Thanks Sonic. I would normally say the comment is unnecessary but then the error suggests it is worth having it. Actually, it would probably be better to put the docs in the header rather than here.
Otherwise, (and given the nature of the fix I'm not that bothered about the comment location).
cc'd Greg KH. (please do this with patches that are bug fixes that don't need much discussion like this one) The drivers are in his staging tree so that's the route for merging this sort of fix.
Quoted 25 lines
--- drivers/staging/iio/industrialio-core.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/staging/iio/industrialio-core.c +2
-1@@ -536,6 +536,7 @@ static void iio_device_unregister_sysfs(struct iio_dev *dev_info)sysfs_remove_group (&dev_info->dev.kobj, dev_info->attrs); } +/* This function return negative value if fails. */ int iio_get_new_idr_val (struct idr *this_idr) {int ret;@@ -659,7 +660,7 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)for (i =0 ; i < dev_info->num_interrupt_lines; i++) { dev_info->event_interfaces[i].owner = dev_info->driver_module; ret =iio_get_new_idr_val (&iio_event_idr); -if (ret) +if (ret <0 ) goto error_free_setup_ev_ints;else dev_info->event_interfaces[i].id = ret;
[email protected]
Appliedpatch staging-iio-function-iio_get_new_idr_val-return-negative-value-if-fails.patch added to gregkh-2.6 tree
This is a note to let you know that I've just added the patch titled
Subject: staging: iio: Function iio_get_new_idr_val() return negative=
value if fails.
to my gregkh-2.6 tree. Its filename is
staging-iio-function-iio_get_new_idr_val-return-negative-value-if-fai=
ls.patch
This tree can be found at=20
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patch=
es/
Quoted 1 line
Quoted 1 line
From [email protected] Thu Apr 22 16:40:17 2010
From: Sonic Zhang <[email protected]>
Date: Mon, 22 Mar 2010 12:27:05 +0000
Subject: staging: iio: Function iio_get_new_idr_val() return negative val= ue if fails.
To: sonic zhang <[email protected]>
Cc: Linux Kernel <[email protected]>, linux-iio <linux-iio@vg= er.kernel.org>, Greg KH <[email protected]>
Message-ID: <[email protected]>
Function iio_get_new_idr_val() return negative value if fails. So, only error when ret < 0 in iio_device_register_eventset().
--- drivers/staging/iio/industrialio-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/iio/industrialio-core.c +0 -0
@@ -537,6 +537,7 @@ static void iio_device_unregister_sysfs(sysfs_remove_group (&dev_info->dev.kobj, dev_info->attrs); }
=20
+/* This function return negative value if fails. */
int iio_get_new_idr_val(struct idr *this_idr)
{
int ret;
@@ -660,7 +661,7 @@ static int iio_device_register_eventset(
for (i =3D 0; i < dev_info->num_interrupt_lines; i++) {
dev_info->event_interfaces[i].owner =3D dev_info->driver_module; ret =3D iio_get_new_idr_val(&iio_event_idr);
- if (ret)
+ if (ret < 0)
goto error_free_setup_ev_ints;
else
dev_info->event_interfaces[i].id =3D ret;