All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: Baruch Siach <baruch@tkos.co.il>
Cc: Marcin Wojtas <mw@semihalf.com>,
	netdev@vger.kernel.org,
	Gregory Clement <gregory.clement@free-electrons.com>
Subject: Re: [PATCH 1/2] net: mvpp2: don't bring up on MAC address set
Date: Wed, 9 Nov 2016 14:22:11 +0100	[thread overview]
Message-ID: <20161109142211.28caffda@free-electrons.com> (raw)
In-Reply-To: <ff17831771f3575f351c134703d3f153485b01c0.1478696194.git.baruch@tkos.co.il>

Hello,

On Wed,  9 Nov 2016 14:56:33 +0200, Baruch Siach wrote:
> Current .ndo_set_mac_address implementation brings up the interface when revert
> to original address after failure succeeds. Fix this.
> 
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>

Indeed, this piece of code is not very smart.

> diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
> index 60227a3452a4..e427b4706726 100644
> --- a/drivers/net/ethernet/marvell/mvpp2.c
> +++ b/drivers/net/ethernet/marvell/mvpp2.c
> @@ -5686,9 +5686,8 @@ static int mvpp2_set_mac_address(struct net_device *dev, void *p)
>  		if (!err)
>  			return 0;
>  		/* Reconfigure parser to accept the original MAC address */
> -		err = mvpp2_prs_update_mac_da(dev, dev->dev_addr);
> -		if (err)
> -			goto error;
> +		mvpp2_prs_update_mac_da(dev, dev->dev_addr);
> +		goto error;

Wouldn't it make more sense to call mvpp2_prs_update_mac_da() under
the error: goto label?

But if you think beyond that, it is a bit crazy that to handle the
error case of mvpp2_prs_update_mac_da(), we have to call
mvpp2_prs_update_mac_da(), which is exactly the same function...

Perhaps it would be interesting to investigate what are the various
conditions for which mvpp2_prs_update_mac_da() fails, and see if we can
avoid them.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  parent reply	other threads:[~2016-11-09 13:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-09 12:56 [PATCH 1/2] net: mvpp2: don't bring up on MAC address set Baruch Siach
2016-11-09 12:56 ` [PATCH 2/2] net: mvpp2: simplify MAC address set code Baruch Siach
2016-11-09 13:22 ` Thomas Petazzoni [this message]
2016-11-09 18:49   ` [PATCH 1/2] net: mvpp2: don't bring up on MAC address set Baruch Siach
2016-11-10 16:57 ` David Miller
2016-11-10 18:08   ` Baruch Siach

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=20161109142211.28caffda@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=baruch@tkos.co.il \
    --cc=gregory.clement@free-electrons.com \
    --cc=mw@semihalf.com \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.