* [PATCH] thermal: rcar_gen3_thermal: Do not shadow rcar_gen3_ths_tj_1
@ 2021-06-07 14:41 Geert Uytterhoeven
2021-06-07 16:43 ` Niklas Söderlund
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2021-06-07 14:41 UTC (permalink / raw)
To: Niklas Söderlund, Zhang Rui, Daniel Lezcano, Amit Kucheria
Cc: linux-renesas-soc, linux-pm, Geert Uytterhoeven
With -Wshadow:
drivers/thermal/rcar_gen3_thermal.c: In function ‘rcar_gen3_thermal_probe’:
drivers/thermal/rcar_gen3_thermal.c:310:13: warning: declaration of ‘rcar_gen3_ths_tj_1’ shadows a global declaration [-Wshadow]
310 | const int *rcar_gen3_ths_tj_1 = of_device_get_match_data(dev);
| ^~~~~~~~~~~~~~~~~~
drivers/thermal/rcar_gen3_thermal.c:246:18: note: shadowed declaration is here
246 | static const int rcar_gen3_ths_tj_1 = 126;
| ^~~~~~~~~~~~~~~~~~
To add to the confusion, the local variable has a different type.
Fix the shadowing by renaming the local variable to ths_tj_1.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/thermal/rcar_gen3_thermal.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
index e1e412348076b2ff..42c079ba0d51e4b3 100644
--- a/drivers/thermal/rcar_gen3_thermal.c
+++ b/drivers/thermal/rcar_gen3_thermal.c
@@ -307,7 +307,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
{
struct rcar_gen3_thermal_priv *priv;
struct device *dev = &pdev->dev;
- const int *rcar_gen3_ths_tj_1 = of_device_get_match_data(dev);
+ const int *ths_tj_1 = of_device_get_match_data(dev);
struct resource *res;
struct thermal_zone_device *zone;
int ret, i;
@@ -352,8 +352,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
priv->tscs[i] = tsc;
priv->thermal_init(tsc);
- rcar_gen3_thermal_calc_coefs(tsc, ptat, thcodes[i],
- *rcar_gen3_ths_tj_1);
+ rcar_gen3_thermal_calc_coefs(tsc, ptat, thcodes[i], *ths_tj_1);
zone = devm_thermal_zone_of_sensor_register(dev, i, tsc,
&rcar_gen3_tz_of_ops);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] thermal: rcar_gen3_thermal: Do not shadow rcar_gen3_ths_tj_1
2021-06-07 14:41 [PATCH] thermal: rcar_gen3_thermal: Do not shadow rcar_gen3_ths_tj_1 Geert Uytterhoeven
@ 2021-06-07 16:43 ` Niklas Söderlund
0 siblings, 0 replies; 2+ messages in thread
From: Niklas Söderlund @ 2021-06-07 16:43 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Zhang Rui, Daniel Lezcano, Amit Kucheria, linux-renesas-soc, linux-pm
Hi Geert,
Thanks for your work.
On 2021-06-07 16:41:20 +0200, Geert Uytterhoeven wrote:
> With -Wshadow:
>
> drivers/thermal/rcar_gen3_thermal.c: In function ‘rcar_gen3_thermal_probe’:
> drivers/thermal/rcar_gen3_thermal.c:310:13: warning: declaration of ‘rcar_gen3_ths_tj_1’ shadows a global declaration [-Wshadow]
> 310 | const int *rcar_gen3_ths_tj_1 = of_device_get_match_data(dev);
> | ^~~~~~~~~~~~~~~~~~
> drivers/thermal/rcar_gen3_thermal.c:246:18: note: shadowed declaration is here
> 246 | static const int rcar_gen3_ths_tj_1 = 126;
> | ^~~~~~~~~~~~~~~~~~
>
> To add to the confusion, the local variable has a different type.
>
> Fix the shadowing by renaming the local variable to ths_tj_1.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
> drivers/thermal/rcar_gen3_thermal.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
> index e1e412348076b2ff..42c079ba0d51e4b3 100644
> --- a/drivers/thermal/rcar_gen3_thermal.c
> +++ b/drivers/thermal/rcar_gen3_thermal.c
> @@ -307,7 +307,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
> {
> struct rcar_gen3_thermal_priv *priv;
> struct device *dev = &pdev->dev;
> - const int *rcar_gen3_ths_tj_1 = of_device_get_match_data(dev);
> + const int *ths_tj_1 = of_device_get_match_data(dev);
> struct resource *res;
> struct thermal_zone_device *zone;
> int ret, i;
> @@ -352,8 +352,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
> priv->tscs[i] = tsc;
>
> priv->thermal_init(tsc);
> - rcar_gen3_thermal_calc_coefs(tsc, ptat, thcodes[i],
> - *rcar_gen3_ths_tj_1);
> + rcar_gen3_thermal_calc_coefs(tsc, ptat, thcodes[i], *ths_tj_1);
>
> zone = devm_thermal_zone_of_sensor_register(dev, i, tsc,
> &rcar_gen3_tz_of_ops);
> --
> 2.25.1
>
--
Regards,
Niklas Söderlund
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-07 16:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-07 14:41 [PATCH] thermal: rcar_gen3_thermal: Do not shadow rcar_gen3_ths_tj_1 Geert Uytterhoeven
2021-06-07 16:43 ` Niklas Söderlund
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.