Skip to contentSkip to conversation

hwmon: (lm90) Unregister hwmon device if interrupt setup fails

PATCH In review Guenter Roeck 2 participants 3 messages Nov 27, 2013 – Dec 1, 2013

Subsystems (2)
lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 1/3 hwmon: (lm90) Unregister hwmon device if interrupt setup fails

Commit 109b1283fb (hwmon: (lm90) Add support to handle IRQ) introduced interrupt support. Its error handling code fails to unregister the already registered hwmon device.

Fixes 109b1283fb532ac773a076748ffccf76a7067cab
---
 drivers/hwmon/lm90.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hwmon/lm90.c +3 -1
index 4c4c142..8b8f3aa 100644
@@ -1610,12 +1610,14 @@ static int lm90_probe(struct i2c_client *client,
 						"lm90", client);
 		if (err < 0) {
 			dev_err(dev, "cannot request IRQ %d\n", client->irq);
-			goto exit_remove_files;
+			goto exit_unregister;
 		}
 	}
 
 	return 0;
 
+exit_unregister:
+	hwmon_device_unregister(data->hwmon_dev);
 exit_remove_files:
 	lm90_remove_files(client, data);
 exit_restore:
Signature · 7 lines
1.7.9.7


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
author maintainer
#1 lore raw
Quoted 21 lines · Guenter Roeck

Commit 109b1283fb (hwmon: (lm90) Add support to handle IRQ) introduced interrupt support. Its error handling code fails to unregister the already registered hwmon device.

Fixes 109b1283fb532ac773a076748ffccf76a7067cab
---
  drivers/hwmon/lm90.c |    4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hwmon/lm90.c +1 -1
index 4c4c142..8b8f3aa 100644
@@ -1610,12 +1610,14 @@ static int lm90_probe(struct i2c_client *client,
  						"lm90", client);
  		if (err < 0) {
  			dev_err(dev, "cannot request IRQ %d\n", client->irq);
-			goto exit_remove_files;
+			goto exit_unregister;

drivers/hwmon/lm90.c static int lm90_probe(struct i2c_client *client, · line 1623

Quoted 10 lines
drivers/hwmon/lm90.c +2 -0
  		}
  	}
 
  	return 0;
 
+exit_unregister:
+	hwmon_device_unregister(data->hwmon_dev);
  exit_remove_files:
  	lm90_remove_files(client, data);
  exit_restore:

Hi Jean,

please ignore the 1/3 in the headline. The other two patches are the conversion to hwmon_device_register_with_groups which I'll need to test first.

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#2 lore raw
In reply to Guenter Roeck

Hi Guenter,

Quoted 20 lines · Guenter Roeck

Commit 109b1283fb (hwmon: (lm90) Add support to handle IRQ) introduced interrupt support. Its error handling code fails to unregister the already registered hwmon device.

Fixes 109b1283fb532ac773a076748ffccf76a7067cab
---
 drivers/hwmon/lm90.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hwmon/lm90.c +1 -1
index 4c4c142..8b8f3aa 100644
@@ -1610,12 +1610,14 @@ static int lm90_probe(struct i2c_client *client,
 						"lm90", client);
 		if (err < 0) {
 			dev_err(dev, "cannot request IRQ %d\n", client->irq);
-			goto exit_remove_files;
+			goto exit_unregister;

drivers/hwmon/lm90.c static int lm90_probe(struct i2c_client *client, · line 1623

Quoted 10 lines
drivers/hwmon/lm90.c +2 -0
 		}
 	}
 
 	return 0;
 
+exit_unregister:
+	hwmon_device_unregister(data->hwmon_dev);
 exit_remove_files:
 	lm90_remove_files(client, data);
 exit_restore:

Good catch, thanks for reporting and sorry for missing this during my code review. Applied.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors