+ ams-check-return-values-from-device_create_file.patch added to -mm tree

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

 



The patch titled

     ams: check return values from device_create_file()

has been added to the -mm tree.  Its filename is

     ams-check-return-values-from-device_create_file.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: ams: check return values from device_create_file()
From: Aristeu Sergio Rozanski Filho <aris@xxxxxxxxxxxxxxxxx>

Change the ams driver in order to check device_create_file() return values
and simplifies ams_sensor_attach().  Andrew, I've been using this driver
for a while (not with -mm, but applying individual patches on latest -linus
daily) and never had problems.

Signed-off-by: Aristeu S. Rozanski F. <aris@xxxxxxxxxxxxxxxxx>
Acked-by: Michael Hanselmann <linux-kernel@xxxxxxxxx>
Cc: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Dmitry Torokhov <dtor_core@xxxxxxxxxxxxx>
Cc: Robert Love <rml@xxxxxxxxxx>
Cc: Jean Delvare <khali@xxxxxxxxxxxx>
Cc: Stelian Pop <stelian@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/hwmon/ams/ams-core.c  |   35 ++++++++++++++++++++------------
 drivers/hwmon/ams/ams-mouse.c |    9 +++++---
 2 files changed, 28 insertions(+), 16 deletions(-)

diff -puN drivers/hwmon/ams/ams-core.c~ams-check-return-values-from-device_create_file drivers/hwmon/ams/ams-core.c
--- a/drivers/hwmon/ams/ams-core.c~ams-check-return-values-from-device_create_file
+++ a/drivers/hwmon/ams/ams-core.c
@@ -163,28 +163,37 @@ int ams_sensor_attach(void)
 	result = pmf_register_irq_client(ams_info.of_node,
 			"accel-int-2",
 			&ams_shock_client);
-	if (result < 0) {
-		pmf_unregister_irq_client(&ams_freefall_client);
-		return -ENODEV;
-	}
+	if (result < 0)
+		goto release_freefall;
 
 	/* Create device */
 	ams_info.of_dev = of_platform_device_create(ams_info.of_node, "ams", NULL);
-	if (!ams_info.of_dev) {
-		pmf_unregister_irq_client(&ams_shock_client);
-		pmf_unregister_irq_client(&ams_freefall_client);
-		return -ENODEV;
-	}
+	if (!ams_info.of_dev)
+		goto release_shock;
 
 	/* Create attributes */
-	device_create_file(&ams_info.of_dev->dev, &dev_attr_current);
+	result = device_create_file(&ams_info.of_dev->dev, &dev_attr_current);
+	if (result)
+		goto release_of;
 
 	ams_info.vflag = !!(ams_info.get_vendor() & 0x10);
 
 	/* Init mouse device */
-	ams_mouse_init();
-
-	return 0;
+	result = ams_mouse_init();
+	if (result)
+		goto release_device_file;
+
+out:
+	return result;
+release_device_file:
+	device_remove_file(&ams_info.of_dev->dev, &dev_attr_current);
+release_of:
+	of_device_unregister(ams_info.of_dev);
+release_shock:
+	pmf_unregister_irq_client(&ams_freefall_client);
+release_freefall:
+	pmf_unregister_irq_client(&ams_freefall_client);
+	goto out;
 }
 
 int __init ams_init(void)
diff -puN drivers/hwmon/ams/ams-mouse.c~ams-check-return-values-from-device_create_file drivers/hwmon/ams/ams-mouse.c
--- a/drivers/hwmon/ams/ams-mouse.c~ams-check-return-values-from-device_create_file
+++ a/drivers/hwmon/ams/ams-mouse.c
@@ -128,12 +128,15 @@ static DEVICE_ATTR(mouse, S_IRUGO | S_IW
 	ams_mouse_show_mouse, ams_mouse_store_mouse);
 
 /* Call with ams_info.lock held! */
-void ams_mouse_init()
+int ams_mouse_init(void)
 {
-	device_create_file(&ams_info.of_dev->dev, &dev_attr_mouse);
+	int result;
 
-	if (mouse)
+	result = device_create_file(&ams_info.of_dev->dev, &dev_attr_mouse);
+
+	if (!result && mouse)
 		ams_mouse_enable();
+	return result;
 }
 
 /* Call with ams_info.lock held! */
_

Patches currently in -mm which might be from aris@xxxxxxxxxxxxxxxxx are

8250-uart-backup-timer.patch
apple-motion-sensor-driver-2-fixes-update.patch
ams-check-return-values-from-device_create_file.patch
add-missing-page_copy-export-for-ppc-and-powerpc.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux