Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1331813 > unrolled thread

[PATCH 2/2] net: dsa: remove phy_disconnect from error path

Started bySascha Hauer <s.hauer@pengutronix.de>
First post2016-02-11 11:50 +0100
Last post2016-02-16 22:10 +0100
Articles 5 — 5 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] net: dsa: remove phy_disconnect from error path Sascha Hauer <s.hauer@pengutronix.de> - 2016-02-11 11:50 +0100
    Re: [PATCH 2/2] net: dsa: remove phy_disconnect from error path Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-02-11 16:40 +0100
      Re: [PATCH 2/2] net: dsa: remove phy_disconnect from error path Neil Armstrong <narmstrong@baylibre.com> - 2016-02-15 10:00 +0100
    Re: [PATCH 2/2] net: dsa: remove phy_disconnect from error path Andrew Lunn <andrew@lunn.ch> - 2016-02-11 16:50 +0100
    Re: [PATCH 2/2] net: dsa: remove phy_disconnect from error path David Miller <davem@davemloft.net> - 2016-02-16 22:10 +0100

#1331813 — [PATCH 2/2] net: dsa: remove phy_disconnect from error path

FromSascha Hauer <s.hauer@pengutronix.de>
Date2016-02-11 11:50 +0100
Subject[PATCH 2/2] net: dsa: remove phy_disconnect from error path
Message-ID<r0WYW-7vk-11@gated-at.bofh.it>
The phy has not been initialized, disconnecting it in the error
path results in a NULL pointer exception. Drop the phy_disconnect
from the error path.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 net/dsa/slave.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 40b9ca7..91e3b2f 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1194,7 +1194,6 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
 	if (ret) {
 		netdev_err(master, "error %d registering interface %s\n",
 			   ret, slave_dev->name);
-		phy_disconnect(p->phy);
 		ds->ports[port] = NULL;
 		free_netdev(slave_dev);
 		return ret;
-- 
2.7.0.rc3

[toc] | [next] | [standalone]


#1332152

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2016-02-11 16:40 +0100
Message-ID<r11vz-2gb-3@gated-at.bofh.it>
In reply to#1331813
Hi Sascha,

Sascha Hauer <s.hauer@pengutronix.de> writes:

> The phy has not been initialized, disconnecting it in the error
> path results in a NULL pointer exception. Drop the phy_disconnect
> from the error path.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  net/dsa/slave.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index 40b9ca7..91e3b2f 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -1194,7 +1194,6 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
>  	if (ret) {
>  		netdev_err(master, "error %d registering interface %s\n",
>  			   ret, slave_dev->name);
> -		phy_disconnect(p->phy);
>  		ds->ports[port] = NULL;
>  		free_netdev(slave_dev);
>  		return ret;

I'm adding Neil in the loop, since he did some work similar to this, if
I'm not mistaken.

Thanks,
-v

[toc] | [prev] | [next] | [standalone]


#1334287

FromNeil Armstrong <narmstrong@baylibre.com>
Date2016-02-15 10:00 +0100
Message-ID<r2naG-6Yj-13@gated-at.bofh.it>
In reply to#1332152
On 02/11/2016 04:39 PM, Vivien Didelot wrote:
> Hi Sascha,
> 
> Sascha Hauer <s.hauer@pengutronix.de> writes:
> 
>> The phy has not been initialized, disconnecting it in the error
>> path results in a NULL pointer exception. Drop the phy_disconnect
>> from the error path.
>>
>> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>> ---
>>  net/dsa/slave.c | 1 -
>>  1 file changed, 1 deletion(-)
>>
>> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
>> index 40b9ca7..91e3b2f 100644
>> --- a/net/dsa/slave.c
>> +++ b/net/dsa/slave.c
>> @@ -1194,7 +1194,6 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
>>  	if (ret) {
>>  		netdev_err(master, "error %d registering interface %s\n",
>>  			   ret, slave_dev->name);
>> -		phy_disconnect(p->phy);
>>  		ds->ports[port] = NULL;
>>  		free_netdev(slave_dev);
>>  		return ret;
> 
> I'm adding Neil in the loop, since he did some work similar to this, if
> I'm not mistaken.
> 
> Thanks,
> -v
> 

He's right, the phy is not yet created in this error path.

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

Thanks Vivien,
Neil

[toc] | [prev] | [next] | [standalone]


#1332172

FromAndrew Lunn <andrew@lunn.ch>
Date2016-02-11 16:50 +0100
Message-ID<r11Fg-2lT-21@gated-at.bofh.it>
In reply to#1331813
On Thu, Feb 11, 2016 at 11:44:49AM +0100, Sascha Hauer wrote:
> The phy has not been initialized, disconnecting it in the error
> path results in a NULL pointer exception. Drop the phy_disconnect
> from the error path.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Hi Sascha

The fix looks correct, since the phy should be bound to the device in
the following dsa_slave_phy_setup() call.

I'm not sure if Neil also fixed this...

Anyway,

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

     Andrew



> ---
>  net/dsa/slave.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index 40b9ca7..91e3b2f 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -1194,7 +1194,6 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
>  	if (ret) {
>  		netdev_err(master, "error %d registering interface %s\n",
>  			   ret, slave_dev->name);
> -		phy_disconnect(p->phy);
>  		ds->ports[port] = NULL;
>  		free_netdev(slave_dev);
>  		return ret;
> -- 
> 2.7.0.rc3
> 

[toc] | [prev] | [next] | [standalone]


#1335843

FromDavid Miller <davem@davemloft.net>
Date2016-02-16 22:10 +0100
Message-ID<r2V2G-4T4-21@gated-at.bofh.it>
In reply to#1331813
From: Sascha Hauer <s.hauer@pengutronix.de>
Date: Thu, 11 Feb 2016 11:44:49 +0100

> The phy has not been initialized, disconnecting it in the error
> path results in a NULL pointer exception. Drop the phy_disconnect
> from the error path.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web