All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rajendra Nayak <rnayak@codeaurora.org>
To: Wei Yongjun <weiyj.lk@gmail.com>, Zhang Rui <rui.zhang@intel.com>,
	Eduardo Valentin <edubezval@gmail.com>,
	Lina Iyer <lina.iyer@linaro.org>
Cc: linux-pm@vger.kernel.org
Subject: Re: [PATCH -next] thermal: qcom: tsens: Fix return value check in init_common()
Date: Wed, 10 Aug 2016 10:29:32 +0530	[thread overview]
Message-ID: <57AAB4B4.4090907@codeaurora.org> (raw)
In-Reply-To: <1469860357-2773-1-git-send-email-weiyj.lk@gmail.com>


On 07/30/2016 12:02 PM, Wei Yongjun wrote:
> In case of error, the function of_iomap() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check
> should be replaced with NULL test.
> And the function devm_regmap_init_mmio() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value
> check should be replaced with IS_ERR().

Thanks for fixing this, I seem to have mixed up the return types
for the two functions

Acked-by: Rajendra Nayak <rnayak@codeaurora.org>

> 
> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
> ---
>  drivers/thermal/qcom/tsens-common.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c
> index 4a1af15..b1449ad 100644
> --- a/drivers/thermal/qcom/tsens-common.c
> +++ b/drivers/thermal/qcom/tsens-common.c
> @@ -128,13 +128,13 @@ int __init init_common(struct tsens_device *tmdev)
>  	void __iomem *base;
>  
>  	base = of_iomap(tmdev->dev->of_node, 0);
> -	if (IS_ERR(base))
> +	if (!base)
>  		return -EINVAL;
>  
>  	tmdev->map = devm_regmap_init_mmio(tmdev->dev, base, &tsens_config);
> -	if (!tmdev->map) {
> +	if (IS_ERR(tmdev->map)) {
>  		iounmap(base);
> -		return -ENODEV;
> +		return PTR_ERR(tmdev->map);
>  	}
>  
>  	return 0;
> 

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

  reply	other threads:[~2016-08-10  4:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-30  6:32 [PATCH -next] thermal: qcom: tsens: Fix return value check in init_common() Wei Yongjun
2016-08-10  4:59 ` Rajendra Nayak [this message]
2016-08-19 13:12 ` Zhang Rui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57AAB4B4.4090907@codeaurora.org \
    --to=rnayak@codeaurora.org \
    --cc=edubezval@gmail.com \
    --cc=lina.iyer@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=weiyj.lk@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.