From: Sonic Zhang Date: Mon, 22 Mar 2010 12:27:05 +0000 (+0000) Subject: staging: iio: Function iio_get_new_idr_val() return negative value if fails. X-Git-Tag: v2.6.34-rc7~36^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a8947fcf3bbeda9fc6ff1205e51f8ff1b0128cc4;p=platform%2Fkernel%2Flinux-stable.git 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 Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c index 37f58f6..5af1a47 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) 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; @@ -660,7 +661,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;