mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH next] usb: dwc3: qcom: Fix error handling in probe
Date: Thu, 24 Apr 2025 23:32:02 +0000	[thread overview]
Message-ID: <20250424233158.vgegsvpuiwm6j6a4@synopsys.com> (raw)
In-Reply-To: <aAijmfAph0FlTqg6@stanley.mountain>

On Wed, Apr 23, 2025, Dan Carpenter wrote:
> There are two issues:
> 1) Return -EINVAL if platform_get_resource() fails.  Don't return
>    success.
> 2) The devm_ioremap() function doesn't return error pointers, it returns
>    NULL.  Update the check.
> 
> Fixes: 1881a32fe14d ("usb: dwc3: qcom: Transition to flattened model")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/usb/dwc3/dwc3-qcom.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index d512002e1e88..b63fcaf823aa 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -740,15 +740,17 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
>  	}
>  
>  	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!r)
> +	if (!r) {
> +		ret = -EINVAL;
>  		goto clk_disable;
> +	}
>  	res = *r;
>  	res.end = res.start + SDM845_QSCRATCH_BASE_OFFSET;
>  
>  	qcom->qscratch_base = devm_ioremap(dev, res.end, SDM845_QSCRATCH_SIZE);
> -	if (IS_ERR(qcom->qscratch_base)) {
> -		dev_err(dev, "failed to map qscratch region: %pe\n", qcom->qscratch_base);
> -		ret = PTR_ERR(qcom->qscratch_base);
> +	if (!qcom->qscratch_base) {
> +		dev_err(dev, "failed to map qscratch region\n");
> +		ret = -ENOMEM;
>  		goto clk_disable;
>  	}
>  
> -- 
> 2.47.2
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

Thanks,
Thinh

      parent reply	other threads:[~2025-04-24 23:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-23  8:23 Dan Carpenter
2025-04-23 12:41 ` Bjorn Andersson
2025-04-24 23:32 ` Thinh Nguyen [this message]

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=20250424233158.vgegsvpuiwm6j6a4@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=bjorn.andersson@oss.qualcomm.com \
    --cc=dan.carpenter@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®