lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed,  7 Apr 2010 18:03:45 +0300
From:	yauhen.kharuzhy@...mwad.com
To:	Jonathan Cameron <jic23@....ac.uk>
Cc:	linux-kernel@...r.kernel.org, Jeff Mahoney <jeffm@...e.com>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	Greg Kroah-Hartman <gregkh@...e.de>,
	devel@...verdev.osuosl.org,
	Yauhen Kharuzhy <yauhen.kharuzhy@...mwad.com>
Subject: [PATCH] IIO: Fix adding more than one iio device eventset

From: Yauhen Kharuzhy <yauhen.kharuzhy@...mwad.com>

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@...mwad.com>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ