2012-02-29 06:32:06

by Dan Carpenter

[permalink] [raw]
Subject: [patch] thermal: spear13xx: checking for NULL instead of IS_ERR()

thermal_zone_device_register() never returns NULL, on error it returns
and ERR_PTR().

Signed-off-by: Dan Carpenter <[email protected]>

diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c
index 880bf28..7352cf8 100644
--- a/drivers/thermal/spear_thermal.c
+++ b/drivers/thermal/spear_thermal.c
@@ -149,9 +149,9 @@ static int spear_thermal_probe(struct platform_device *pdev)

spear_thermal = thermal_zone_device_register("spear_thermal", 0,
stdev, &ops, 0, 0, 0, 0);
- if (!spear_thermal) {
+ if (IS_ERR(spear_thermal)) {
dev_err(&pdev->dev, "thermal zone device is NULL\n");
- ret = -EINVAL;
+ ret = PTR_ERR(spear_thermal);
goto disable_clk;
}


2012-02-29 06:35:12

by Viresh Kumar

[permalink] [raw]
Subject: Re: [patch] thermal: spear13xx: checking for NULL instead of IS_ERR()

On 2/29/2012 12:01 PM, Dan Carpenter wrote:
> thermal_zone_device_register() never returns NULL, on error it returns
> and ERR_PTR().
>
> Signed-off-by: Dan Carpenter <[email protected]>
>
> diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c
> index 880bf28..7352cf8 100644
> --- a/drivers/thermal/spear_thermal.c
> +++ b/drivers/thermal/spear_thermal.c
> @@ -149,9 +149,9 @@ static int spear_thermal_probe(struct platform_device *pdev)
>
> spear_thermal = thermal_zone_device_register("spear_thermal", 0,
> stdev, &ops, 0, 0, 0, 0);
> - if (!spear_thermal) {
> + if (IS_ERR(spear_thermal)) {
> dev_err(&pdev->dev, "thermal zone device is NULL\n");
> - ret = -EINVAL;
> + ret = PTR_ERR(spear_thermal);
> goto disable_clk;
> }
>

Thanks.

Reviewed-by: Viresh Kumar <[email protected]>

--
viresh

2012-02-29 08:59:56

by Vincenzo Frascino

[permalink] [raw]
Subject: Re: [patch] thermal: spear13xx: checking for NULL instead of IS_ERR()

Thanks Dan.

Il 29/02/2012 07:31, Dan Carpenter ha scritto:
> thermal_zone_device_register() never returns NULL, on error it returns
> and ERR_PTR().
>
> Signed-off-by: Dan Carpenter <[email protected]>
>
> diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c
> index 880bf28..7352cf8 100644
> --- a/drivers/thermal/spear_thermal.c
> +++ b/drivers/thermal/spear_thermal.c
> @@ -149,9 +149,9 @@ static int spear_thermal_probe(struct platform_device *pdev)
>
> spear_thermal = thermal_zone_device_register("spear_thermal", 0,
> stdev, &ops, 0, 0, 0, 0);
> - if (!spear_thermal) {
> + if (IS_ERR(spear_thermal)) {
> dev_err(&pdev->dev, "thermal zone device is NULL\n");
> - ret = -EINVAL;
> + ret = PTR_ERR(spear_thermal);
> goto disable_clk;
> }
>

Reviewed-by: Vincenzo Frascino <[email protected]>