* [PATCH 0/3] PHY: Fixes for 3.13-rc
@ 2013-12-06 12:21 Kishon Vijay Abraham I
2013-12-06 12:21 ` [PATCH 1/3] drivers: phy: Fix memory leak Kishon Vijay Abraham I
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Kishon Vijay Abraham I @ 2013-12-06 12:21 UTC (permalink / raw)
To: gregkh, linux-kernel; +Cc: kishon
Hi Greg,
We have three patches to be merged in PHY subsystem for this rc cycle and
all of them are critical.
One fixes a memory leak, the other solves a NULL dereference while calling
dev_WARN and the last one fixes a randconfig error.
Let me know if I have to change anything.
I've also queued these fixes in
https://git.kernel.org/cgit/linux/kernel/git/kishon/linux-phy.git/ fixes
(contains patches to be merged in other trees too).
Dan Carpenter (1):
drivers: phy: tweaks to phy_create()
Kishon Vijay Abraham I (1):
phy: kconfig: add depends on "USB_PHY" to OMAP_USB2 and TWL4030_USB
Sachin Kamat (1):
drivers: phy: Fix memory leak
drivers/phy/Kconfig | 4 ++--
drivers/phy/phy-core.c | 26 ++++++++++----------------
2 files changed, 12 insertions(+), 18 deletions(-)
--
1.7.10.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] drivers: phy: Fix memory leak
2013-12-06 12:21 [PATCH 0/3] PHY: Fixes for 3.13-rc Kishon Vijay Abraham I
@ 2013-12-06 12:21 ` Kishon Vijay Abraham I
2013-12-06 12:21 ` [PATCH 2/3] drivers: phy: tweaks to phy_create() Kishon Vijay Abraham I
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Kishon Vijay Abraham I @ 2013-12-06 12:21 UTC (permalink / raw)
To: gregkh, linux-kernel; +Cc: kishon, Sachin Kamat
From: Sachin Kamat <sachin.kamat@linaro.org>
'phy' was not being freed upon error in one of the cases.
Adjust the 'goto's to fix this.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
drivers/phy/phy-core.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 03cf8fb..712b358 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -453,7 +453,7 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
if (id < 0) {
dev_err(dev, "unable to get id\n");
ret = id;
- goto err0;
+ goto err1;
}
device_initialize(&phy->dev);
@@ -468,11 +468,11 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
ret = dev_set_name(&phy->dev, "phy-%s.%d", dev_name(dev), id);
if (ret)
- goto err1;
+ goto err2;
ret = device_add(&phy->dev);
if (ret)
- goto err1;
+ goto err2;
if (pm_runtime_enabled(dev)) {
pm_runtime_enable(&phy->dev);
@@ -481,11 +481,11 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
return phy;
-err1:
+err2:
ida_remove(&phy_ida, phy->id);
put_device(&phy->dev);
+err1:
kfree(phy);
-
err0:
return ERR_PTR(ret);
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] drivers: phy: tweaks to phy_create()
2013-12-06 12:21 [PATCH 0/3] PHY: Fixes for 3.13-rc Kishon Vijay Abraham I
2013-12-06 12:21 ` [PATCH 1/3] drivers: phy: Fix memory leak Kishon Vijay Abraham I
@ 2013-12-06 12:21 ` Kishon Vijay Abraham I
2013-12-06 12:21 ` [PATCH 3/3] phy: kconfig: add depends on "USB_PHY" to OMAP_USB2 and TWL4030_USB Kishon Vijay Abraham I
2013-12-10 20:55 ` [PATCH 0/3] PHY: Fixes for 3.13-rc Greg KH
3 siblings, 0 replies; 5+ messages in thread
From: Kishon Vijay Abraham I @ 2013-12-06 12:21 UTC (permalink / raw)
To: gregkh, linux-kernel; +Cc: kishon, Dan Carpenter
From: Dan Carpenter <dan.carpenter@oracle.com>
If this was called with a NULL "dev" then it lead to a NULL dereference
when we called dev_WARN(). I have changed it to WARN_ON() so that we
get a stack dump and can fix the caller.
The rest of this patch is just cleanup like returning directly instead
of having do-nothing gotos. Using descriptive labels instead of
GW-BASIC style "err0" and "err1". I also flipped the order of
put_device() and ida_remove() so they are a mirror reflection of the
order they were allocated.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
drivers/phy/phy-core.c | 26 ++++++++++----------------
1 file changed, 10 insertions(+), 16 deletions(-)
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 712b358..58e0e97 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -437,23 +437,18 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
int id;
struct phy *phy;
- if (!dev) {
- dev_WARN(dev, "no device provided for PHY\n");
- ret = -EINVAL;
- goto err0;
- }
+ if (WARN_ON(!dev))
+ return ERR_PTR(-EINVAL);
phy = kzalloc(sizeof(*phy), GFP_KERNEL);
- if (!phy) {
- ret = -ENOMEM;
- goto err0;
- }
+ if (!phy)
+ return ERR_PTR(-ENOMEM);
id = ida_simple_get(&phy_ida, 0, 0, GFP_KERNEL);
if (id < 0) {
dev_err(dev, "unable to get id\n");
ret = id;
- goto err1;
+ goto free_phy;
}
device_initialize(&phy->dev);
@@ -468,11 +463,11 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
ret = dev_set_name(&phy->dev, "phy-%s.%d", dev_name(dev), id);
if (ret)
- goto err2;
+ goto put_dev;
ret = device_add(&phy->dev);
if (ret)
- goto err2;
+ goto put_dev;
if (pm_runtime_enabled(dev)) {
pm_runtime_enable(&phy->dev);
@@ -481,12 +476,11 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
return phy;
-err2:
- ida_remove(&phy_ida, phy->id);
+put_dev:
put_device(&phy->dev);
-err1:
+ ida_remove(&phy_ida, phy->id);
+free_phy:
kfree(phy);
-err0:
return ERR_PTR(ret);
}
EXPORT_SYMBOL_GPL(phy_create);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] phy: kconfig: add depends on "USB_PHY" to OMAP_USB2 and TWL4030_USB
2013-12-06 12:21 [PATCH 0/3] PHY: Fixes for 3.13-rc Kishon Vijay Abraham I
2013-12-06 12:21 ` [PATCH 1/3] drivers: phy: Fix memory leak Kishon Vijay Abraham I
2013-12-06 12:21 ` [PATCH 2/3] drivers: phy: tweaks to phy_create() Kishon Vijay Abraham I
@ 2013-12-06 12:21 ` Kishon Vijay Abraham I
2013-12-10 20:55 ` [PATCH 0/3] PHY: Fixes for 3.13-rc Greg KH
3 siblings, 0 replies; 5+ messages in thread
From: Kishon Vijay Abraham I @ 2013-12-06 12:21 UTC (permalink / raw)
To: gregkh, linux-kernel; +Cc: kishon
Fixes
warning: (OMAP_USB2 && TWL4030_USB) selects USB_PHY which has unmet
direct dependencies (USB_SUPPORT)
that shows up while disabling USB_SUPPORT from menuconfig.
Reported-by: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
---
drivers/phy/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index a344f3d..330ef2d 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -24,8 +24,8 @@ config PHY_EXYNOS_MIPI_VIDEO
config OMAP_USB2
tristate "OMAP USB2 PHY Driver"
depends on ARCH_OMAP2PLUS
+ depends on USB_PHY
select GENERIC_PHY
- select USB_PHY
select OMAP_CONTROL_USB
help
Enable this to support the transceiver that is part of SOC. This
@@ -36,8 +36,8 @@ config OMAP_USB2
config TWL4030_USB
tristate "TWL4030 USB Transceiver Driver"
depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS
+ depends on USB_PHY
select GENERIC_PHY
- select USB_PHY
help
Enable this to support the USB OTG transceiver on TWL4030
family chips (including the TWL5030 and TPS659x0 devices).
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] PHY: Fixes for 3.13-rc
2013-12-06 12:21 [PATCH 0/3] PHY: Fixes for 3.13-rc Kishon Vijay Abraham I
` (2 preceding siblings ...)
2013-12-06 12:21 ` [PATCH 3/3] phy: kconfig: add depends on "USB_PHY" to OMAP_USB2 and TWL4030_USB Kishon Vijay Abraham I
@ 2013-12-10 20:55 ` Greg KH
3 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2013-12-10 20:55 UTC (permalink / raw)
To: Kishon Vijay Abraham I; +Cc: linux-kernel
On Fri, Dec 06, 2013 at 05:51:17PM +0530, Kishon Vijay Abraham I wrote:
> Hi Greg,
> We have three patches to be merged in PHY subsystem for this rc cycle and
> all of them are critical.
>
> One fixes a memory leak, the other solves a NULL dereference while calling
> dev_WARN and the last one fixes a randconfig error.
>
> Let me know if I have to change anything.
>
> I've also queued these fixes in
> https://git.kernel.org/cgit/linux/kernel/git/kishon/linux-phy.git/ fixes
> (contains patches to be merged in other trees too).
Ick, I can't take that, as it wouldn't work properly. If you want to
send me pull requests, please use the proper format and a signed tag.
> Dan Carpenter (1):
> drivers: phy: tweaks to phy_create()
>
> Kishon Vijay Abraham I (1):
> phy: kconfig: add depends on "USB_PHY" to OMAP_USB2 and TWL4030_USB
>
> Sachin Kamat (1):
> drivers: phy: Fix memory leak
I've now taken these, sorry for the delay.
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-12-10 20:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-06 12:21 [PATCH 0/3] PHY: Fixes for 3.13-rc Kishon Vijay Abraham I
2013-12-06 12:21 ` [PATCH 1/3] drivers: phy: Fix memory leak Kishon Vijay Abraham I
2013-12-06 12:21 ` [PATCH 2/3] drivers: phy: tweaks to phy_create() Kishon Vijay Abraham I
2013-12-06 12:21 ` [PATCH 3/3] phy: kconfig: add depends on "USB_PHY" to OMAP_USB2 and TWL4030_USB Kishon Vijay Abraham I
2013-12-10 20:55 ` [PATCH 0/3] PHY: Fixes for 3.13-rc Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox