Skip to content

Commit 0a7e453

Browse files
committed
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal management fixes from Zhang Rui. * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: thermal: exynos_thermal: return a proper error code while thermal_zone_device_register fail. thermal: rcar_thermal: propagate return value of thermal_zone_device_register Thermal: kirkwood: Convert to devm_ioremap_resource() Thermal: rcar: Convert to devm_ioremap_resource() Thermal: dove: Convert to devm_ioremap_resource() thermal: rcar: fix missing unlock on error in rcar_thermal_update_temp()
2 parents cd82346 + 043e465 commit 0a7e453

4 files changed

Lines changed: 24 additions & 31 deletions

File tree

‎drivers/thermal/dove_thermal.c‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,22 +143,18 @@ static int dove_thermal_probe(struct platform_device *pdev)
143143
if (!priv)
144144
return -ENOMEM;
145145

146-
priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
147-
if (!priv->sensor) {
148-
dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
149-
return -EADDRNOTAVAIL;
150-
}
146+
priv->sensor = devm_ioremap_resource(&pdev->dev, res);
147+
if (IS_ERR(priv->sensor))
148+
return PTR_ERR(priv->sensor);
151149

152150
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
153151
if (!res) {
154152
dev_err(&pdev->dev, "Failed to get platform resource\n");
155153
return -ENODEV;
156154
}
157-
priv->control = devm_request_and_ioremap(&pdev->dev, res);
158-
if (!priv->control) {
159-
dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
160-
return -EADDRNOTAVAIL;
161-
}
155+
priv->control = devm_ioremap_resource(&pdev->dev, res);
156+
if (IS_ERR(priv->control))
157+
return PTR_ERR(priv->control);
162158

163159
ret = dove_init_sensor(priv);
164160
if (ret) {

‎drivers/thermal/exynos_thermal.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ static int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf)
476476

477477
if (IS_ERR(th_zone->therm_dev)) {
478478
pr_err("Failed to register thermal zone device\n");
479-
ret = -EINVAL;
479+
ret = PTR_ERR(th_zone->therm_dev);
480480
goto err_unregister;
481481
}
482482
th_zone->mode = THERMAL_DEVICE_ENABLED;

‎drivers/thermal/kirkwood_thermal.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,9 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)
8585
if (!priv)
8686
return -ENOMEM;
8787

88-
priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
89-
if (!priv->sensor) {
90-
dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
91-
return -EADDRNOTAVAIL;
92-
}
88+
priv->sensor = devm_ioremap_resource(&pdev->dev, res);
89+
if (IS_ERR(priv->sensor))
90+
return PTR_ERR(priv->sensor);
9391

9492
thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0,
9593
priv, &ops, NULL, 0, 0);

‎drivers/thermal/rcar_thermal.c‎

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
145145
struct device *dev = rcar_priv_to_dev(priv);
146146
int i;
147147
int ctemp, old, new;
148+
int ret = -EINVAL;
148149

149150
mutex_lock(&priv->lock);
150151

@@ -174,7 +175,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
174175

175176
if (!ctemp) {
176177
dev_err(dev, "thermal sensor was broken\n");
177-
return -EINVAL;
178+
goto err_out_unlock;
178179
}
179180

180181
/*
@@ -192,10 +193,10 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
192193
dev_dbg(dev, "thermal%d %d -> %d\n", priv->id, priv->ctemp, ctemp);
193194

194195
priv->ctemp = ctemp;
195-
196+
ret = 0;
197+
err_out_unlock:
196198
mutex_unlock(&priv->lock);
197-
198-
return 0;
199+
return ret;
199200
}
200201

201202
static int rcar_thermal_get_temp(struct thermal_zone_device *zone,
@@ -363,6 +364,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
363364
struct resource *res, *irq;
364365
int mres = 0;
365366
int i;
367+
int ret = -ENODEV;
366368
int idle = IDLE_INTERVAL;
367369

368370
common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL);
@@ -399,11 +401,9 @@ static int rcar_thermal_probe(struct platform_device *pdev)
399401
/*
400402
* rcar_has_irq_support() will be enabled
401403
*/
402-
common->base = devm_request_and_ioremap(dev, res);
403-
if (!common->base) {
404-
dev_err(dev, "Unable to ioremap thermal register\n");
405-
return -ENOMEM;
406-
}
404+
common->base = devm_ioremap_resource(dev, res);
405+
if (IS_ERR(common->base))
406+
return PTR_ERR(common->base);
407407

408408
/* enable temperature comparation */
409409
rcar_thermal_common_write(common, ENR, 0x00030303);
@@ -422,11 +422,9 @@ static int rcar_thermal_probe(struct platform_device *pdev)
422422
return -ENOMEM;
423423
}
424424

425-
priv->base = devm_request_and_ioremap(dev, res);
426-
if (!priv->base) {
427-
dev_err(dev, "Unable to ioremap priv register\n");
428-
return -ENOMEM;
429-
}
425+
priv->base = devm_ioremap_resource(dev, res);
426+
if (IS_ERR(priv->base))
427+
return PTR_ERR(priv->base);
430428

431429
priv->common = common;
432430
priv->id = i;
@@ -441,6 +439,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
441439
idle);
442440
if (IS_ERR(priv->zone)) {
443441
dev_err(dev, "can't register thermal zone\n");
442+
ret = PTR_ERR(priv->zone);
444443
goto error_unregister;
445444
}
446445

@@ -460,7 +459,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
460459
rcar_thermal_for_each_priv(priv, common)
461460
thermal_zone_device_unregister(priv->zone);
462461

463-
return -ENODEV;
462+
return ret;
464463
}
465464

466465
static int rcar_thermal_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)