Skip to contentSkip to conversation

hwmon sysfs class, again

RFC PATCH In review Mark M. Hoffman 3 participants 6 messages Jun 28, 2005 – Jul 15, 2005

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 hwmon sysfs class, again

Hi all:

Here are the "new and improved" hwmon sysfs class patches:

http://members.dca.net/mhoffman/sensors/temp/20050627/

Jean Delvare's recent patches[1] must be applied first. I plan to submit the hwmon/sysfs patches for inclusion into -mm shortly after Jean's are submitted.

[1] http://lists.lm-sensors.org/pipermail/lm-sensors/2005-June/012850.html

Regards,

Signature · 2 lines
Mark M. Hoffman
[email protected]
#2 lore raw
In reply to Mark M. Hoffman

Hi Mark,

Quoted 3 lines

Here are the "new and improved" hwmon sysfs class patches:

http://members.dca.net/mhoffman/sensors/temp/20050627/

Looks all OK to me, except for:

drivers/hwmon/adm1026.c int adm1026_detect(struct i2c_adapter *a

Quoted 8 lines
drivers/hwmon/adm1026.c +1 -1
(...)
@@ -1690,8 +1701,10 @@ int adm1026_detect(struct i2c_adapter *a
(...)
 exitfree:
-	kfree(new_client);
+	kfree(data);

Although this fix is correct, it would belong to hwmon-chips-kfree-fix.patch, not hwmon-class-chips.patch.

Also, it looks to me like adm9240, smsc47m1 and smsc47b397 need the same fix.

drivers/hwmon/asb100.c

Quoted 8 lines
drivers/hwmon/asb100.c +5 -0
(..)
+        data->class_dev = hwmon_device_register(&new_client->dev);
+        if (IS_ERR(data->class_dev)) {
+                err = PTR_ERR(data->class_dev);
+                goto ERROR3;
+        }

Beware you are using spaces instead of tabulations here.

drivers/hwmon/w83781d.c

Quoted 12 lines
drivers/hwmon/w83781d.c +9 -0
(...)
+ERROR4:
+	if (NULL != data->lm75[1]) {
+		i2c_detach_client(data->lm75[1]);
+		kfree(data->lm75[1]);
+	}
+	if (NULL != data->lm75[0]) {
+		i2c_detach_client(data->lm75[0]);
+		kfree(data->lm75[0]);
+	}

Please express the comparisons the other way around. I can guess why you did it this way, but the usual style in the kernel is different and gcc would warn you anyway.

Thanks,
--
Jean Delvare

#3 lore raw
In reply to Mark M. Hoffman

Hi Jean:

Thanks for the review.

Quoted 21 lines · Jean Delvare

Hi Mark,

Quoted 3 lines

Here are the "new and improved" hwmon sysfs class patches:

http://members.dca.net/mhoffman/sensors/temp/20050627/

Looks all OK to me, except for:

drivers/hwmon/adm1026.c int adm1026_detect(struct i2c_adapter *a

Quoted 8 lines
drivers/hwmon/adm1026.c +1 -1
(...)
@@ -1690,8 +1701,10 @@ int adm1026_detect(struct i2c_adapter *a
(...)
 exitfree:
-	kfree(new_client);
+	kfree(data);

Although this fix is correct, it would belong to hwmon-chips-kfree-fix.patch, not hwmon-class-chips.patch.

Quoted 2 lines

Also, it looks to me like adm9240, smsc47m1 and smsc47b397 need the same fix.

right - fixed all of that

Quoted 10 lines

drivers/hwmon/asb100.c

Quoted 8 lines
drivers/hwmon/asb100.c +5 -0
(..)
+        data->class_dev = hwmon_device_register(&new_client->dev);
+        if (IS_ERR(data->class_dev)) {
+                err = PTR_ERR(data->class_dev);
+                goto ERROR3;
+        }

Beware you are using spaces instead of tabulations here.

oops - fixed

Quoted 8 lines
Quoted 8 lines
drivers/hwmon/w83781d.c +5 -0
(...)
+ERROR4:
+	if (NULL != data->lm75[1]) {
+		i2c_detach_client(data->lm75[1]);
+		kfree(data->lm75[1]);
+	}
Quoted 8 lines

drivers/hwmon/w83781d.c

Quoted 4 lines
drivers/hwmon/w83781d.c +4 -0
+	if (NULL != data->lm75[0]) {
+		i2c_detach_client(data->lm75[0]);
+		kfree(data->lm75[0]);
+	}

Please express the comparisons the other way around. I can guess why you did it this way, but the usual style in the kernel is different and gcc would warn you anyway.

Actually, there were two of those already in the file (probably by me though). I prefer 'if (p)' myself, but the day job code style is stamped on my brain, heh. Anyway, they're fixed.

New patches here:

http://members.dca.net/mhoffman/sensors/temp/20050703/

Regards,

Signature · 2 lines
Mark M. Hoffman
[email protected]