[PATCH] IIO: Fix adding more than one iio device eventset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Yauhen Kharuzhy <yauhen.kharuzhy@xxxxxxxxxxx>

iio_get_new_idr_val() returns new id, but this value was checked as
usual error code.

Also fix typo in sysfs attribute name generation, seems that this name
should be unique.

Signed-off-by: Yauhen Kharuzhy <yauhen.kharuzhy@xxxxxxxxxxx>
---
 drivers/staging/iio/industrialio-core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index b456dfc..8d33584 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -659,7 +659,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;
@@ -685,7 +685,7 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)
 
 	for (i = 0; i < dev_info->num_interrupt_lines; i++) {
 		snprintf(dev_info->event_interfaces[i]._attrname, 20,
-			"event_line%d_sources", i);
+			"event_line%d_sources", dev_info->event_interfaces[i].id);
 		dev_info->event_attrs[i].name
 			= (const char *)
 			(dev_info->event_interfaces[i]._attrname);
-- 
1.6.6.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux