Skip to contentSkip to conversation

hwmon: Use PTR_ERR_OR_ZERO instead of reimplementing its function

PATCH Guenter Roeck 2 participants 2 messages Sep 16, 2018 Hardware monitoring

lore
Share & tools
lore

Guenter Roeck

author maintainer Applied
#0 lore raw
Quoted 4 lines · zhong jiang

PTR_ERR_OR_ZERO has implemented the same function. We prefer to use inlined function rather than code-opened implementation.

Applied to hwmon-next. For future patches, please also refer to the affected driver in the Subject line, unless the change is in the subsystem core code.

Thanks,
Guenter

Quoted 23 lines
---
 drivers/hwmon/asus_atk0110.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/hwmon/asus_atk0110.c +1 -3
index a6636fe..a7cf008 100644
@@ -1210,10 +1210,8 @@ static int atk_register_hwmon(struct atk_data *data)
 	data->hwmon_dev = hwmon_device_register_with_groups(dev, "atk0110",
 							    data,
 							    data->attr_groups);
-	if (IS_ERR(data->hwmon_dev))
-		return PTR_ERR(data->hwmon_dev);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(data->hwmon_dev);
 }
 
 static int atk_probe_if(struct atk_data *data)
Signature · 1 line
1.7.12.4
#1 lore raw
Quoted 8 lines · Guenter Roeck
Quoted 4 lines · zhong jiang

PTR_ERR_OR_ZERO has implemented the same function. We prefer to use inlined function rather than code-opened implementation.

Applied to hwmon-next. For future patches, please also refer to the affected driver in the Subject line, unless the change is in the subsystem core code.

Get it. Thanks.

Sincerely,
zhong jiang

Quoted 27 lines

Thanks,
Guenter

Quoted 23 lines
---
 drivers/hwmon/asus_atk0110.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/hwmon/asus_atk0110.c +1 -3
index a6636fe..a7cf008 100644
@@ -1210,10 +1210,8 @@ static int atk_register_hwmon(struct atk_data *data)
 	data->hwmon_dev = hwmon_device_register_with_groups(dev, "atk0110",
 							    data,
 							    data->attr_groups);
-	if (IS_ERR(data->hwmon_dev))
-		return PTR_ERR(data->hwmon_dev);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(data->hwmon_dev);
 }
 
 static int atk_probe_if(struct atk_data *data)
Signature · 1 line
1.7.12.4