* [PATCH 1/2] thermal: rcar_thermal: propagate return value of thermal_zone_device_register
@ 2013-03-04 16:52 Devendra Naga
2013-03-04 16:52 ` [PATCH 2/2] thermal: exynos_thermal: return a proper error code while thermal_zone_device_register fail Devendra Naga
2013-03-11 14:47 ` [PATCH 1/2] thermal: rcar_thermal: propagate return value of thermal_zone_device_register Zhang Rui
0 siblings, 2 replies; 4+ messages in thread
From: Devendra Naga @ 2013-03-04 16:52 UTC (permalink / raw)
To: Zhang Rui, linux-pm; +Cc: Devendra Naga
thermal_zone_device_register returns a value contained in the pointer itself
use PTR_ERR to obtain the address and return it at the end.
Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
---
drivers/thermal/rcar_thermal.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 28f0919..f1726c9 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -363,6 +363,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
struct resource *res, *irq;
int mres = 0;
int i;
+ int ret = -ENODEV;
int idle = IDLE_INTERVAL;
common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL);
@@ -441,6 +442,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
idle);
if (IS_ERR(priv->zone)) {
dev_err(dev, "can't register thermal zone\n");
+ ret = PTR_ERR(priv->zone);
goto error_unregister;
}
@@ -460,7 +462,7 @@ error_unregister:
rcar_thermal_for_each_priv(priv, common)
thermal_zone_device_unregister(priv->zone);
- return -ENODEV;
+ return ret;
}
static int rcar_thermal_remove(struct platform_device *pdev)
--
1.8.1.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] thermal: exynos_thermal: return a proper error code while thermal_zone_device_register fail.
2013-03-04 16:52 [PATCH 1/2] thermal: rcar_thermal: propagate return value of thermal_zone_device_register Devendra Naga
@ 2013-03-04 16:52 ` Devendra Naga
2013-03-11 14:47 ` Zhang Rui
2013-03-11 14:47 ` [PATCH 1/2] thermal: rcar_thermal: propagate return value of thermal_zone_device_register Zhang Rui
1 sibling, 1 reply; 4+ messages in thread
From: Devendra Naga @ 2013-03-04 16:52 UTC (permalink / raw)
To: Zhang Rui, linux-pm; +Cc: Devendra Naga
we are returning EINVAL while the thermal_zone_device_register function fail.
instead we can use the return value from the thermal_zone_device_register by
using PTR_ERR.
Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
---
drivers/thermal/exynos_thermal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
index e04ebd8..46568c0 100644
--- a/drivers/thermal/exynos_thermal.c
+++ b/drivers/thermal/exynos_thermal.c
@@ -476,7 +476,7 @@ static int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf)
if (IS_ERR(th_zone->therm_dev)) {
pr_err("Failed to register thermal zone device\n");
- ret = -EINVAL;
+ ret = PTR_ERR(th_zone->therm_dev);
goto err_unregister;
}
th_zone->mode = THERMAL_DEVICE_ENABLED;
--
1.8.1.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] thermal: rcar_thermal: propagate return value of thermal_zone_device_register
2013-03-04 16:52 [PATCH 1/2] thermal: rcar_thermal: propagate return value of thermal_zone_device_register Devendra Naga
2013-03-04 16:52 ` [PATCH 2/2] thermal: exynos_thermal: return a proper error code while thermal_zone_device_register fail Devendra Naga
@ 2013-03-11 14:47 ` Zhang Rui
1 sibling, 0 replies; 4+ messages in thread
From: Zhang Rui @ 2013-03-11 14:47 UTC (permalink / raw)
To: Devendra Naga; +Cc: linux-pm
On Mon, 2013-03-04 at 11:52 -0500, Devendra Naga wrote:
> thermal_zone_device_register returns a value contained in the pointer itself
> use PTR_ERR to obtain the address and return it at the end.
>
> Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Applied to thermal -next.
thanks,
rui
> ---
> drivers/thermal/rcar_thermal.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index 28f0919..f1726c9 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -363,6 +363,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
> struct resource *res, *irq;
> int mres = 0;
> int i;
> + int ret = -ENODEV;
> int idle = IDLE_INTERVAL;
>
> common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL);
> @@ -441,6 +442,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
> idle);
> if (IS_ERR(priv->zone)) {
> dev_err(dev, "can't register thermal zone\n");
> + ret = PTR_ERR(priv->zone);
> goto error_unregister;
> }
>
> @@ -460,7 +462,7 @@ error_unregister:
> rcar_thermal_for_each_priv(priv, common)
> thermal_zone_device_unregister(priv->zone);
>
> - return -ENODEV;
> + return ret;
> }
>
> static int rcar_thermal_remove(struct platform_device *pdev)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] thermal: exynos_thermal: return a proper error code while thermal_zone_device_register fail.
2013-03-04 16:52 ` [PATCH 2/2] thermal: exynos_thermal: return a proper error code while thermal_zone_device_register fail Devendra Naga
@ 2013-03-11 14:47 ` Zhang Rui
0 siblings, 0 replies; 4+ messages in thread
From: Zhang Rui @ 2013-03-11 14:47 UTC (permalink / raw)
To: Devendra Naga; +Cc: linux-pm
On Mon, 2013-03-04 at 11:52 -0500, Devendra Naga wrote:
> we are returning EINVAL while the thermal_zone_device_register function fail.
> instead we can use the return value from the thermal_zone_device_register by
> using PTR_ERR.
>
> Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
applied to thermal -next.
thanks,
rui
> ---
> drivers/thermal/exynos_thermal.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
> index e04ebd8..46568c0 100644
> --- a/drivers/thermal/exynos_thermal.c
> +++ b/drivers/thermal/exynos_thermal.c
> @@ -476,7 +476,7 @@ static int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf)
>
> if (IS_ERR(th_zone->therm_dev)) {
> pr_err("Failed to register thermal zone device\n");
> - ret = -EINVAL;
> + ret = PTR_ERR(th_zone->therm_dev);
> goto err_unregister;
> }
> th_zone->mode = THERMAL_DEVICE_ENABLED;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-03-11 14:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-04 16:52 [PATCH 1/2] thermal: rcar_thermal: propagate return value of thermal_zone_device_register Devendra Naga
2013-03-04 16:52 ` [PATCH 2/2] thermal: exynos_thermal: return a proper error code while thermal_zone_device_register fail Devendra Naga
2013-03-11 14:47 ` Zhang Rui
2013-03-11 14:47 ` [PATCH 1/2] thermal: rcar_thermal: propagate return value of thermal_zone_device_register Zhang Rui
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).