public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Cc: agross@kernel.org, bjorn.andersson@linaro.org, balbi@kernel.org,
	p.zabel@pengutronix.de, 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 11:44:21 +0100	[thread overview]
Message-ID: <YcBehfPqhHpd/FSK@kroah.com> (raw)
In-Reply-To: <20211220101520.930658-1-jiasheng@iscas.ac.cn>

On Mon, Dec 20, 2021 at 06:15:20PM +0800, Jiasheng Jiang wrote:
> The return value of platform_get_irq() needs to be checked.
> To avoid use of null pointer 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) {
> +		ret = -EINVAL;

That is NOT the proper way to check the return value of this function
call.



  reply	other threads:[~2021-12-20 10:44 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 [this message]
2021-12-20 11:25 ` Sergey Shtylyov
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=YcBehfPqhHpd/FSK@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=agross@kernel.org \
    --cc=balbi@kernel.org \
    --cc=bjorn.andersson@linaro.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