Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thermal/drivers/sprd: Fix return value of sprd_thm_probe()

When call function devm_platform_ioremap_resource(), we should use IS_ERR()
to check the return value and return PTR_ERR() if failed.

Fixes: 554fdbaf19b1 ("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

authored by

Tiezhu Yang and committed by
Daniel Lezcano
b4147917 14533a5a

+2 -2
+2 -2
drivers/thermal/sprd_thermal.c
··· 348 348 349 349 thm->var_data = pdata; 350 350 thm->base = devm_platform_ioremap_resource(pdev, 0); 351 - if (!thm->base) 352 - return -ENOMEM; 351 + if (IS_ERR(thm->base)) 352 + return PTR_ERR(thm->base); 353 353 354 354 thm->nr_sensors = of_get_child_count(np); 355 355 if (thm->nr_sensors == 0 || thm->nr_sensors > SPRD_THM_MAX_SENSOR) {