lkml.org 
[lkml]   [2021]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] usb: dwc3: qcom: Check for null irq pointer
From
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

\
 
 \ /
  Last update: 2021-12-20 12:26    [W:0.080 / U:1.496 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site