phy: rockchip: inno-usb2: Handle errors from optional IRQ lookup
Subsystems (2)
PATCH 1/1 phy: rockchip: inno-usb2: Handle errors from optional IRQ lookup
From: bui duc phuc <[email protected]>
platform_get_irq_optional() can return errors such as -EPROBE_DEFER, but the driver currently stores the return value directly in rphy->irq and continues probing.
Propagate negative errors other than -ENXIO using dev_err_probe(), and only assign the IRQ to rphy->irq when a valid IRQ number is returned.
Signed-off-by bui duc phuc <[email protected]>
--- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +6 -1
@@ -1390,7 +1390,12 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev) phy_cfgs =device_get_match_data (dev); rphy->chg_state =USB_CHG_STATE_UNDEFINED ; rphy->chg_type =POWER_SUPPLY_TYPE_UNKNOWN ; - rphy->irq =platform_get_irq_optional (pdev,0 ); + ret =platform_get_irq_optional (pdev,0 ); +if (ret <0 && ret != -ENXIO ) +return dev_err_probe (dev, ret,"failed to get IRQ resource\n" ); +if (ret >0 ) + rphy->irq = ret; +platform_set_drvdata (pdev, rphy);if (!phy_cfgs)
Signature · 1 line
2.43.0