aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSonic Zhang <sonic.adi@gmail.com>2010-03-22 08:27:05 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-04-30 12:30:09 -0400
commita8947fcf3bbeda9fc6ff1205e51f8ff1b0128cc4 (patch)
tree5a7774c771316cb5554743c53dc34f4f7e44eb30 /drivers
parentee58cb2bcda99ae934176ad5ae66f7699d23cd3d (diff)
staging: 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(). Signed-off-by: Sonic Zhang <sonic.adi@gmail.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/iio/industrialio-core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index 37f58f66e491..5af1a4783434 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -537,6 +537,7 @@ static void iio_device_unregister_sysfs(struct iio_dev *dev_info)
537 sysfs_remove_group(&dev_info->dev.kobj, dev_info->attrs); 537 sysfs_remove_group(&dev_info->dev.kobj, dev_info->attrs);
538} 538}
539 539
540/* This function return negative value if fails. */
540int iio_get_new_idr_val(struct idr *this_idr) 541int iio_get_new_idr_val(struct idr *this_idr)
541{ 542{
542 int ret; 543 int ret;
@@ -660,7 +661,7 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)
660 for (i = 0; i < dev_info->num_interrupt_lines; i++) { 661 for (i = 0; i < dev_info->num_interrupt_lines; i++) {
661 dev_info->event_interfaces[i].owner = dev_info->driver_module; 662 dev_info->event_interfaces[i].owner = dev_info->driver_module;
662 ret = iio_get_new_idr_val(&iio_event_idr); 663 ret = iio_get_new_idr_val(&iio_event_idr);
663 if (ret) 664 if (ret < 0)
664 goto error_free_setup_ev_ints; 665 goto error_free_setup_ev_ints;
665 else 666 else
666 dev_info->event_interfaces[i].id = ret; 667 dev_info->event_interfaces[i].id = ret;