linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] hwmon: Use PTR_ERR_OR_ZERO instead of reimplementing its function
@ 2018-09-16  0:43 Guenter Roeck
  2018-09-16 14:56 ` zhong jiang
  0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2018-09-16  0:43 UTC (permalink / raw)
  To: zhong jiang; +Cc: kronos.it, jdelvare, linux-hwmon, linux-kernel

On Tue, Sep 11, 2018 at 08:03:37PM +0800, zhong jiang wrote:
> PTR_ERR_OR_ZERO has implemented the same function. We prefer to use
> inlined function rather than code-opened implementation.
> 
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>

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

> ---
>  drivers/hwmon/asus_atk0110.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c
> index a6636fe..a7cf008 100644
> --- a/drivers/hwmon/asus_atk0110.c
> +++ b/drivers/hwmon/asus_atk0110.c
> @@ -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)
> -- 
> 1.7.12.4
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [PATCH] hwmon: Use PTR_ERR_OR_ZERO instead of reimplementing its function
@ 2018-09-11 12:03 zhong jiang
  0 siblings, 0 replies; 3+ messages in thread
From: zhong jiang @ 2018-09-11 12:03 UTC (permalink / raw)
  To: kronos.it, jdelvare, linux; +Cc: linux-hwmon, linux-kernel

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

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 drivers/hwmon/asus_atk0110.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c
index a6636fe..a7cf008 100644
--- a/drivers/hwmon/asus_atk0110.c
+++ b/drivers/hwmon/asus_atk0110.c
@@ -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)
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-16 14:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-16  0:43 [PATCH] hwmon: Use PTR_ERR_OR_ZERO instead of reimplementing its function Guenter Roeck
2018-09-16 14:56 ` zhong jiang
  -- strict thread matches above, loose matches on Subject: below --
2018-09-11 12:03 zhong jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).