diff mbox

[v2,06/16] net: stmmac: fix some code style problem

Message ID 20170208083121.27949-7-clabbe.montjoie@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Corentin Labbe Feb. 8, 2017, 8:31 a.m. UTC
Checkpatch complains about some code style problem on stmmac_mdio.c.
This patch fix them.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Joe Perches Feb. 8, 2017, 10:41 a.m. UTC | #1
On Wed, 2017-02-08 at 09:31 +0100, Corentin Labbe wrote:
> Checkpatch complains about some code style problem on stmmac_mdio.c.
> This patch fix them.
[]
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
[]
> @@ -258,6 +258,7 @@ int stmmac_mdio_register(struct net_device *ndev)
>  	found = 0;
>  	for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
>  		struct phy_device *phydev = mdiobus_get_phy(new_bus, addr);
> +
>  		if (phydev) {
>  			int act = 0;
>  			char irq_num[4];

Maybe use
		if (!phydev)
			continue;
to reduce indentation
Sergei Shtylyov Feb. 8, 2017, 11:57 a.m. UTC | #2
Hello!

On 2/8/2017 11:31 AM, Corentin Labbe wrote:

> Checkpatch complains about some code style problem on stmmac_mdio.c.
> This patch fix them.

    Fixes.

> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> index 3fdc6ec..c24bef2 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
[...]
> @@ -267,7 +268,7 @@ int stmmac_mdio_register(struct net_device *ndev)
>  			 * If an IRQ was provided to be assigned after
>  			 * the bus probe, do it here.
>  			 */
> -			if ((mdio_bus_data->irqs == NULL) &&
> +			if ((!mdio_bus_data->irqs) &&

    Innermost parens not needed (and weren't needed before).

>  			    (mdio_bus_data->probed_phy_irq > 0)) {
>  				new_bus->irq[addr] =
>  					mdio_bus_data->probed_phy_irq;

MBR, Sergei
Corentin Labbe Feb. 8, 2017, 3:06 p.m. UTC | #3
On Wed, Feb 08, 2017 at 02:41:58AM -0800, Joe Perches wrote:
> On Wed, 2017-02-08 at 09:31 +0100, Corentin Labbe wrote:
> > Checkpatch complains about some code style problem on stmmac_mdio.c.
> > This patch fix them.
> []
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> []
> > @@ -258,6 +258,7 @@ int stmmac_mdio_register(struct net_device *ndev)
> >  	found = 0;
> >  	for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
> >  		struct phy_device *phydev = mdiobus_get_phy(new_bus, addr);
> > +
> >  		if (phydev) {
> >  			int act = 0;
> >  			char irq_num[4];
> 
> Maybe use
> 		if (!phydev)
> 			continue;
> to reduce indentation

Thanks I will do it in a subsequent patch

Regards
Corentin Labbe
diff mbox

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 3fdc6ec..c24bef2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -152,9 +152,9 @@  int stmmac_mdio_reset(struct mii_bus *bus)
 
 #ifdef CONFIG_OF
 	if (priv->device->of_node) {
-
 		if (data->reset_gpio < 0) {
 			struct device_node *np = priv->device->of_node;
+
 			if (!np)
 				return 0;
 
@@ -221,7 +221,7 @@  int stmmac_mdio_register(struct net_device *ndev)
 		return 0;
 
 	new_bus = mdiobus_alloc();
-	if (new_bus == NULL)
+	if (!new_bus)
 		return -ENOMEM;
 
 	if (mdio_bus_data->irqs)
@@ -258,6 +258,7 @@  int stmmac_mdio_register(struct net_device *ndev)
 	found = 0;
 	for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
 		struct phy_device *phydev = mdiobus_get_phy(new_bus, addr);
+
 		if (phydev) {
 			int act = 0;
 			char irq_num[4];
@@ -267,7 +268,7 @@  int stmmac_mdio_register(struct net_device *ndev)
 			 * If an IRQ was provided to be assigned after
 			 * the bus probe, do it here.
 			 */
-			if ((mdio_bus_data->irqs == NULL) &&
+			if ((!mdio_bus_data->irqs) &&
 			    (mdio_bus_data->probed_phy_irq > 0)) {
 				new_bus->irq[addr] =
 					mdio_bus_data->probed_phy_irq;