Skip to content

Commit 4e28f79

Browse files
pchelkin91gregkh
authored andcommitted
usb: chipidea: ci_hdrc_imx: fix usbmisc handling
usbmisc is an optional device property so it is totally valid for the corresponding data->usbmisc_data to have a NULL value. Check that before dereferencing the pointer. Found by Linux Verification Center (linuxtesting.org) with Svace static analysis tool. Fixes: 74adad5 ("usb: chipidea: ci_hdrc_imx: decrement device's refcount in .remove() and in the error path of .probe()") Cc: stable <stable@kernel.org> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru> Acked-by: Peter Chen <peter.chen@kernel.org> Link: https://lore.kernel.org/r/20250316102658.490340-2-pchelkin@ispras.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 66e1a88 commit 4e28f79

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/usb/chipidea/ci_hdrc_imx.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,8 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
534534
cpu_latency_qos_remove_request(&data->pm_qos_req);
535535
data->ci_pdev = NULL;
536536
err_put:
537-
put_device(data->usbmisc_data->dev);
537+
if (data->usbmisc_data)
538+
put_device(data->usbmisc_data->dev);
538539
return ret;
539540
}
540541

@@ -559,7 +560,8 @@ static void ci_hdrc_imx_remove(struct platform_device *pdev)
559560
if (data->hsic_pad_regulator)
560561
regulator_disable(data->hsic_pad_regulator);
561562
}
562-
put_device(data->usbmisc_data->dev);
563+
if (data->usbmisc_data)
564+
put_device(data->usbmisc_data->dev);
563565
}
564566

565567
static void ci_hdrc_imx_shutdown(struct platform_device *pdev)

0 commit comments

Comments
 (0)