Skip to content

Commit 2e3dd4a

Browse files
jonhuntergregkh
authored andcommitted
usb: common: ulpi: Fix crash in ulpi_match()
Commit 7495af9 ("ARM: multi_v7_defconfig: Enable drivers for DragonBoard 410c") enables the CONFIG_PHY_QCOM_USB_HS for the ARM multi_v7_defconfig. Enabling this Kconfig is causing the kernel to crash on the Tegra20 Ventana platform in the ulpi_match() function. The Qualcomm USB HS PHY driver that is enabled by CONFIG_PHY_QCOM_USB_HS, registers a ulpi_driver but this driver does not provide an 'id_table', so when ulpi_match() is called on the Tegra20 Ventana platform, it crashes when attempting to deference the id_table pointer which is not valid. The Qualcomm USB HS PHY driver uses device-tree for matching the ULPI driver with the device and so fix this crash by using device-tree for matching if the id_table is not valid. Fixes: ef6a7bc ("usb: ulpi: Support device discovery via DT") Cc: stable <[email protected]> Signed-off-by: Jon Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 904edf8 commit 2e3dd4a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/usb/common/ulpi.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ static int ulpi_match(struct device *dev, struct device_driver *driver)
3939
struct ulpi *ulpi = to_ulpi_dev(dev);
4040
const struct ulpi_device_id *id;
4141

42-
/* Some ULPI devices don't have a vendor id so rely on OF match */
43-
if (ulpi->id.vendor == 0)
42+
/*
43+
* Some ULPI devices don't have a vendor id
44+
* or provide an id_table so rely on OF match.
45+
*/
46+
if (ulpi->id.vendor == 0 || !drv->id_table)
4447
return of_driver_match_device(dev, driver);
4548

4649
for (id = drv->id_table; id->vendor; id++)

0 commit comments

Comments
 (0)