public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergey Shtylyov <s.shtylyov@omp.ru>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>, <agross@kernel.org>,
	<bjorn.andersson@linaro.org>, <balbi@kernel.org>,
	<gregkh@linuxfoundation.org>, <p.zabel@pengutronix.de>
Cc: <linux-arm-msm@vger.kernel.org>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: dwc3: qcom: Check for null irq pointer
Date: Mon, 20 Dec 2021 14:25:42 +0300	[thread overview]
Message-ID: <d7974f16-74b1-4d8a-2c28-8acb710d6310@omp.ru> (raw)
In-Reply-To: <20211220101520.930658-1-jiasheng@iscas.ac.cn>

On 20.12.2021 13:15, Jiasheng Jiang wrote:

> The return value of platform_get_irq() needs to be checked.
> To avoid use of null pointer

   What null pointer, could you please clarify?

in case that there is no irq.
> 
> Fixes: 2bc02355f8ba ("usb: dwc3: qcom: Add support for booting with ACPI")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>   drivers/usb/dwc3/dwc3-qcom.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index 49e6ca94486d..f04fb3f2fb85 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -614,6 +614,11 @@ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev)
>   		qcom->acpi_pdata->dwc3_core_base_size;
>   
>   	irq = platform_get_irq(pdev_irq, 0);
> +	if (!irq) {

    This is totally wrong! That function returns negative error codes in case 
of failure.

> +		ret = -EINVAL;
> +		goto out;
> +	}
> +
>   	child_res[1].flags = IORESOURCE_IRQ;
>   	child_res[1].start = child_res[1].end = irq;

MBR, Sergey

  parent reply	other threads:[~2021-12-20 11:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-20 10:15 [PATCH] usb: dwc3: qcom: Check for null irq pointer Jiasheng Jiang
2021-12-20 10:44 ` Greg KH
2021-12-20 11:25 ` Sergey Shtylyov [this message]
2021-12-20 11:48   ` Sergey Shtylyov
2021-12-20 12:14     ` Greg KH
2021-12-20 12:22       ` Sergey Shtylyov

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=d7974f16-74b1-4d8a-2c28-8acb710d6310@omp.ru \
    --to=s.shtylyov@omp.ru \
    --cc=agross@kernel.org \
    --cc=balbi@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jiasheng@iscas.ac.cn \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    /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