Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: phy: Fix NULL pointer exception during usb_get_phy

Upon initialisation (driver probe) a NULL pointer exception
is triggered. This is due to lack of initialisation of
device field in phy structure, which is used by phy
framework in usb_get_phy().

Fix it by initialising the device field.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

Robert Jarzmik and committed by
Felipe Balbi
1abd8b31 9d6ab420

+3
+1
drivers/usb/phy/phy-fsl-usb.c
··· 799 799 800 800 /* initialize the otg structure */ 801 801 fsl_otg_tc->phy.label = DRIVER_DESC; 802 + fsl_otg_tc->phy.dev = &pdev->dev; 802 803 fsl_otg_tc->phy.set_power = fsl_otg_set_power; 803 804 804 805 fsl_otg_tc->phy.otg->phy = &fsl_otg_tc->phy;
+1
drivers/usb/phy/phy-gpio-vbus-usb.c
··· 266 266 platform_set_drvdata(pdev, gpio_vbus); 267 267 gpio_vbus->dev = &pdev->dev; 268 268 gpio_vbus->phy.label = "gpio-vbus"; 269 + gpio_vbus->phy.dev = gpio_vbus->dev; 269 270 gpio_vbus->phy.set_power = gpio_vbus_set_power; 270 271 gpio_vbus->phy.set_suspend = gpio_vbus_set_suspend; 271 272 gpio_vbus->phy.state = OTG_STATE_UNDEFINED;
+1
drivers/usb/phy/phy-isp1301.c
··· 102 102 mutex_init(&isp->mutex); 103 103 104 104 phy = &isp->phy; 105 + phy->dev = &client->dev; 105 106 phy->label = DRV_NAME; 106 107 phy->init = isp1301_phy_init; 107 108 phy->set_vbus = isp1301_phy_set_vbus;