[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150503.220633.467179430594919041.davem@davemloft.net>
Date: Sun, 03 May 2015 22:06:33 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: f.fainelli@...il.com
Cc: netdev@...r.kernel.org, vivien.didelot@...oirfairelinux.com,
jerome.oufella@...oirfairelinux.com, linux@...ck-us.net,
andrew@...n.ch, cphealy@...il.com, mathieu@...eaurora.org,
jonasj76@...il.com, andrey.volkov@...vision.fr,
Chris.Packham@...iedtelesis.co.nz
Subject: Re: [RFC PATCH net-next 4/8] net: mv643xx_eth: Handle Ethernet
switches as PHY devices
From: Florian Fainelli <f.fainelli@...il.com>
Date: Wed, 29 Apr 2015 18:57:40 -0700
> @@ -2321,7 +2321,7 @@ static void port_start(struct mv643xx_eth_private *mp)
> wrlp(mp, PORT_SERIAL_CONTROL, pscr);
>
> pscr |= DO_NOT_FORCE_LINK_FAIL;
> - if (mp->phy == NULL)
> + if (mp->phy == NULL || (mp->phy && phy_is_ethswitch(mp->phy)))
> pscr |= FORCE_LINK_PASS;
Maybe it looks clearer to you in this form, but the C language
guarentees that:
if (!ptr || ptr->foo)
will not perform a NULL pointer deref.
So I'm pretty sure you could simply this statement to:
if (mp->phy == NULL || phy_is_ethswitch(mp->phy))
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists