Skip to content

Commit

Permalink
thermal/drivers/sprd: Fix return value of sprd_thm_probe()
Browse files Browse the repository at this point in the history
When call function devm_platform_ioremap_resource(), we should use IS_ERR()
to check the return value and return PTR_ERR() if failed.

Fixes: 554fdba ("thermal: sprd: Add Spreadtrum thermal driver support")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/1590371941-25430-1-git-send-email-yangtiezhu@loongson.cn
  • Loading branch information
Tiezhu Yang authored and Daniel Lezcano committed Jun 29, 2020
1 parent 14533a5 commit b414791
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/thermal/sprd_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@ static int sprd_thm_probe(struct platform_device *pdev)

thm->var_data = pdata;
thm->base = devm_platform_ioremap_resource(pdev, 0);
if (!thm->base)
return -ENOMEM;
if (IS_ERR(thm->base))
return PTR_ERR(thm->base);

thm->nr_sensors = of_get_child_count(np);
if (thm->nr_sensors == 0 || thm->nr_sensors > SPRD_THM_MAX_SENSOR) {
Expand Down

0 comments on commit b414791

Please sign in to comment.