* [PATCH] phy: tegra: add missing put_device() call in tegra210_xusb_padctl_probe()
@ 2021-12-07 12:56 ` Qing Wang
0 siblings, 0 replies; 6+ messages in thread
From: Qing Wang @ 2021-12-07 12:56 UTC (permalink / raw)
To: JC Kuo, Kishon Vijay Abraham I, Vinod Koul, Thierry Reding,
Jonathan Hunter, linux-phy, linux-tegra, linux-kernel
Cc: Wang Qing
From: Wang Qing <wangqing@vivo.com>
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 <wangqing@vivo.com>
---
drivers/phy/tegra/xusb-tegra210.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/phy/tegra/xusb-tegra210.c b/drivers/phy/tegra/xusb-tegra210.c
index eedfc7c..05a0800
--- a/drivers/phy/tegra/xusb-tegra210.c
+++ b/drivers/phy/tegra/xusb-tegra210.c
@@ -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)
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] phy: tegra: add missing put_device() call in tegra210_xusb_padctl_probe()
@ 2021-12-07 12:56 ` Qing Wang
0 siblings, 0 replies; 6+ messages in thread
From: Qing Wang @ 2021-12-07 12:56 UTC (permalink / raw)
To: JC Kuo, Kishon Vijay Abraham I, Vinod Koul, Thierry Reding,
Jonathan Hunter, linux-phy, linux-tegra, linux-kernel
Cc: Wang Qing
From: Wang Qing <wangqing@vivo.com>
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 <wangqing@vivo.com>
---
drivers/phy/tegra/xusb-tegra210.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/phy/tegra/xusb-tegra210.c b/drivers/phy/tegra/xusb-tegra210.c
index eedfc7c..05a0800
--- a/drivers/phy/tegra/xusb-tegra210.c
+++ b/drivers/phy/tegra/xusb-tegra210.c
@@ -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)
--
2.7.4
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] phy: tegra: add missing put_device() call in tegra210_xusb_padctl_probe()
2021-12-07 12:56 ` Qing Wang
@ 2021-12-07 14:35 ` Dmitry Osipenko
-1 siblings, 0 replies; 6+ messages in thread
From: Dmitry Osipenko @ 2021-12-07 14:35 UTC (permalink / raw)
To: Qing Wang, JC Kuo, Kishon Vijay Abraham I, Vinod Koul,
Thierry Reding, Jonathan Hunter, linux-phy, linux-tegra,
linux-kernel
07.12.2021 15:56, Qing Wang пишет:
> From: Wang Qing <wangqing@vivo.com>
>
> 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 <wangqing@vivo.com>
> ---
> drivers/phy/tegra/xusb-tegra210.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/phy/tegra/xusb-tegra210.c b/drivers/phy/tegra/xusb-tegra210.c
> index eedfc7c..05a0800
> --- a/drivers/phy/tegra/xusb-tegra210.c
> +++ b/drivers/phy/tegra/xusb-tegra210.c
> @@ -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)
>
What if dev_get_regmap() fails? What if driver is removed?
Please either fix it properly or don't fix it.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] phy: tegra: add missing put_device() call in tegra210_xusb_padctl_probe()
@ 2021-12-07 14:35 ` Dmitry Osipenko
0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Osipenko @ 2021-12-07 14:35 UTC (permalink / raw)
To: Qing Wang, JC Kuo, Kishon Vijay Abraham I, Vinod Koul,
Thierry Reding, Jonathan Hunter, linux-phy, linux-tegra,
linux-kernel
07.12.2021 15:56, Qing Wang пишет:
> From: Wang Qing <wangqing@vivo.com>
>
> 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 <wangqing@vivo.com>
> ---
> drivers/phy/tegra/xusb-tegra210.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/phy/tegra/xusb-tegra210.c b/drivers/phy/tegra/xusb-tegra210.c
> index eedfc7c..05a0800
> --- a/drivers/phy/tegra/xusb-tegra210.c
> +++ b/drivers/phy/tegra/xusb-tegra210.c
> @@ -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)
>
What if dev_get_regmap() fails? What if driver is removed?
Please either fix it properly or don't fix it.
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] phy: tegra: add missing put_device() call in tegra210_xusb_padctl_probe()
2021-12-07 14:35 ` Dmitry Osipenko
@ 2021-12-07 14:37 ` Dmitry Osipenko
-1 siblings, 0 replies; 6+ messages in thread
From: Dmitry Osipenko @ 2021-12-07 14:37 UTC (permalink / raw)
To: Qing Wang, JC Kuo, Kishon Vijay Abraham I, Vinod Koul,
Thierry Reding, Jonathan Hunter, linux-phy, linux-tegra,
linux-kernel
07.12.2021 17:35, Dmitry Osipenko пишет:
> 07.12.2021 15:56, Qing Wang пишет:
>> From: Wang Qing <wangqing@vivo.com>
>>
>> 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 <wangqing@vivo.com>
>> ---
>> drivers/phy/tegra/xusb-tegra210.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/phy/tegra/xusb-tegra210.c b/drivers/phy/tegra/xusb-tegra210.c
>> index eedfc7c..05a0800
>> --- a/drivers/phy/tegra/xusb-tegra210.c
>> +++ b/drivers/phy/tegra/xusb-tegra210.c
>> @@ -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)
>>
>
> 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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] phy: tegra: add missing put_device() call in tegra210_xusb_padctl_probe()
@ 2021-12-07 14:37 ` Dmitry Osipenko
0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Osipenko @ 2021-12-07 14:37 UTC (permalink / raw)
To: Qing Wang, JC Kuo, Kishon Vijay Abraham I, Vinod Koul,
Thierry Reding, Jonathan Hunter, linux-phy, linux-tegra,
linux-kernel
07.12.2021 17:35, Dmitry Osipenko пишет:
> 07.12.2021 15:56, Qing Wang пишет:
>> From: Wang Qing <wangqing@vivo.com>
>>
>> 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 <wangqing@vivo.com>
>> ---
>> drivers/phy/tegra/xusb-tegra210.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/phy/tegra/xusb-tegra210.c b/drivers/phy/tegra/xusb-tegra210.c
>> index eedfc7c..05a0800
>> --- a/drivers/phy/tegra/xusb-tegra210.c
>> +++ b/drivers/phy/tegra/xusb-tegra210.c
>> @@ -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)
>>
>
> 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.
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-12-07 15:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07 12:56 [PATCH] phy: tegra: add missing put_device() call in tegra210_xusb_padctl_probe() Qing Wang
2021-12-07 12:56 ` Qing Wang
2021-12-07 14:35 ` Dmitry Osipenko
2021-12-07 14:35 ` Dmitry Osipenko
2021-12-07 14:37 ` Dmitry Osipenko
2021-12-07 14:37 ` Dmitry Osipenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.