phy: tegra: add missing put_device() call in tegra210_xusb_padctl_probe()
PATCH 1/1 phy: tegra: add missing put_device() call in tegra210_xusb_padctl_probe()
From: Wang Qing <[email protected]>
of_find_device_by_node() takes a reference to the embedded struct device which needs to be dropped when error return.
--- drivers/phy/tegra/xusb-tegra210.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/phy/tegra/xusb-tegra210.c +3 -1
@@ -3170,8 +3170,10 @@ tegra210_xusb_padctl_probe(struct device *dev, goto out; } -if (!platform_get_drvdata (pdev)) +if (!platform_get_drvdata (pdev)) { +put_device (&pdev->dev);return ERR_PTR (-EPROBE_DEFER ); + } padctl->regmap =dev_get_regmap (&pdev->dev,"usb_sleepwalk" );if (!padctl->regmap)
Signature · 1 line
2.7.4
07.12.2021 15:56, Qing Wang пишет:
Quoted 17 lines
From: Wang Qing <[email protected]>
of_find_device_by_node()takes a reference to the embedded struct device which needs to be dropped when error return.Signed-off-by Wang Qing <[email protected]>--- drivers/phy/tegra/xusb-tegra210.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/phy/tegra/xusb-tegra210.c +0
-0@@ -3170,8 +3170,10 @@ tegra210_xusb_padctl_probe(struct device *dev, goto out;
drivers/phy/tegra/xusb-tegra210.c tegra210_xusb_padctl_probe(struct device *dev, · line 3179
Quoted 10 lines
drivers/phy/tegra/xusb-tegra210.c +3
-1} -if (!platform_get_drvdata (pdev)) +if (!platform_get_drvdata (pdev)) { +put_device (&pdev->dev);return ERR_PTR (-EPROBE_DEFER ); + } padctl->regmap =dev_get_regmap (&pdev->dev,"usb_sleepwalk" );if (!padctl->regmap)
What if dev_get_regmap() fails? What if driver is removed?
Please either fix it properly or don't fix it.
07.12.2021 17:35, Dmitry Osipenko пишет:
Quoted 25 lines
07.12.2021 15:56, Qing Wang пишет:
Quoted 24 lines
From: Wang Qing <[email protected]>
of_find_device_by_node()takes a reference to the embedded struct device which needs to be dropped when error return.Signed-off-by Wang Qing <[email protected]>--- drivers/phy/tegra/xusb-tegra210.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/phy/tegra/xusb-tegra210.c +3
-1@@ -3170,8 +3170,10 @@ tegra210_xusb_padctl_probe(struct device *dev, goto out; } -if (!platform_get_drvdata (pdev)) +if (!platform_get_drvdata (pdev)) { +put_device (&pdev->dev);return ERR_PTR (-EPROBE_DEFER ); + }
Quoted 8 lines
drivers/phy/tegra/xusb-tegra210.c tegra210_xusb_padctl_probe(struct device *dev, · line 3179
Quoted 3 lines
drivers/phy/tegra/xusb-tegra210.c +0
-0padctl->regmap =dev_get_regmap (&pdev->dev,"usb_sleepwalk" );if (!padctl->regmap)What if
dev_get_regmap()fails? What if driver is removed?Please either fix it properly or don't fix it.
My bad, I see now in the code that this dev_get_regmap() fail is okay. Nevertheless the driver removal is incorrect.