Linux-PM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] thermal: sprd: Fix return value of sprd_thm_probe()
@ 2020-05-25  1:59 Tiezhu Yang
  2020-05-29 14:25 ` Baolin Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Tiezhu Yang @ 2020-05-25  1:59 UTC (permalink / raw)
  To: Zhang Rui, Daniel Lezcano, Amit Kucheria
  Cc: linux-pm, linux-kernel, Xuefeng Li, Tiezhu Yang

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>
---
 drivers/thermal/sprd_thermal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c
index a340374..4cde70d 100644
--- a/drivers/thermal/sprd_thermal.c
+++ b/drivers/thermal/sprd_thermal.c
@@ -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) {
-- 
2.1.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] thermal: sprd: Fix return value of sprd_thm_probe()
  2020-05-25  1:59 [PATCH] thermal: sprd: Fix return value of sprd_thm_probe() Tiezhu Yang
@ 2020-05-29 14:25 ` Baolin Wang
  2020-06-29 13:14   ` Amit Kucheria
  0 siblings, 1 reply; 3+ messages in thread
From: Baolin Wang @ 2020-05-29 14:25 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: Zhang Rui, Daniel Lezcano, Amit Kucheria, Linux PM, LKML, Xuefeng Li

Hi,

On Mon, May 25, 2020 at 10:00 AM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
>
> 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>

Good catch. Thanks.
Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>

> ---
>  drivers/thermal/sprd_thermal.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c
> index a340374..4cde70d 100644
> --- a/drivers/thermal/sprd_thermal.c
> +++ b/drivers/thermal/sprd_thermal.c
> @@ -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) {
> --
> 2.1.0
>


-- 
Baolin Wang

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] thermal: sprd: Fix return value of sprd_thm_probe()
  2020-05-29 14:25 ` Baolin Wang
@ 2020-06-29 13:14   ` Amit Kucheria
  0 siblings, 0 replies; 3+ messages in thread
From: Amit Kucheria @ 2020-06-29 13:14 UTC (permalink / raw)
  To: Baolin Wang
  Cc: Tiezhu Yang, Zhang Rui, Daniel Lezcano, Linux PM, LKML, Xuefeng Li

On Fri, May 29, 2020 at 7:55 PM Baolin Wang <baolin.wang7@gmail.com> wrote:
>
> Hi,
>
> On Mon, May 25, 2020 at 10:00 AM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
> >
> > 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>
>
> Good catch. Thanks.
> Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>

Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>

> > ---
> >  drivers/thermal/sprd_thermal.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c
> > index a340374..4cde70d 100644
> > --- a/drivers/thermal/sprd_thermal.c
> > +++ b/drivers/thermal/sprd_thermal.c
> > @@ -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) {
> > --
> > 2.1.0
> >
>
>
> --
> Baolin Wang

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-25  1:59 [PATCH] thermal: sprd: Fix return value of sprd_thm_probe() Tiezhu Yang
2020-05-29 14:25 ` Baolin Wang
2020-06-29 13:14   ` Amit Kucheria

Linux-PM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pm/0 linux-pm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pm linux-pm/ https://lore.kernel.org/linux-pm \
		linux-pm@vger.kernel.org
	public-inbox-index linux-pm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git