mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Tang Bin <tangbin@cmss.chinamobile.com>,
	davem@davemloft.net, andrew@lunn.ch, kuba@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Subject: Re: [PATCH] net: mdio: Remove redundant parameter and check
Date: Wed, 23 Sep 2020 12:10:06 +0200	[thread overview]
Message-ID: <860585f8-65a7-3363-18cd-dc398772ba00@gmail.com> (raw)
In-Reply-To: <20200923100532.18452-1-tangbin@cmss.chinamobile.com>

On 23.09.2020 12:05, Tang Bin wrote:
> In the function ipq8064_mdio_probe(), of_mdiobus_register() might
> returned zero, so the direct return can simplify code. Thus remove
> redundant parameter and check.
> 
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> ---
>  drivers/net/mdio/mdio-ipq8064.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/mdio/mdio-ipq8064.c b/drivers/net/mdio/mdio-ipq8064.c
> index 1bd1885..33cccce 100644
> --- a/drivers/net/mdio/mdio-ipq8064.c
> +++ b/drivers/net/mdio/mdio-ipq8064.c
> @@ -102,7 +102,6 @@ ipq8064_mdio_probe(struct platform_device *pdev)
>  	struct device_node *np = pdev->dev.of_node;
>  	struct ipq8064_mdio *priv;
>  	struct mii_bus *bus;
> -	int ret;
>  
>  	bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*priv));
>  	if (!bus)
> @@ -125,12 +124,9 @@ ipq8064_mdio_probe(struct platform_device *pdev)
>  		return PTR_ERR(priv->base);
>  	}
>  
> -	ret = of_mdiobus_register(bus, np);
> -	if (ret)
> -		return ret;
> -
>  	platform_set_drvdata(pdev, bus);

Before your patch this is called only after of_mdiobus_register()
returns successfully. Now it's called unconditionally before.
Are you sure this can't have a side effect?

> -	return 0;
> +
> +	return of_mdiobus_register(bus, np);
>  }
>  
>  static int
> 


  reply	other threads:[~2020-09-23 10:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 10:05 Tang Bin
2020-09-23 10:10 ` Heiner Kallweit [this message]
2020-09-24  1:10 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=860585f8-65a7-3363-18cd-dc398772ba00@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tangbin@cmss.chinamobile.com \
    --cc=zhangshengju@cmss.chinamobile.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®