All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@xilinx.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCHv2] net: zynq_gem: Do not return -ENOSYS on success
Date: Wed, 5 Apr 2017 08:29:22 +0200	[thread overview]
Message-ID: <1077f359-cce7-bdca-086a-aba90aee5f3d@xilinx.com> (raw)
In-Reply-To: <20170403141853.11574-1-oliver@schinagl.nl>

On 3.4.2017 16:18, Olliver Schinagl wrote:
> The .read_rom_hwaddr net_ops hook does not check the return value, which
> is why it was never caught that we are currently returning 0 if the
> read_rom_hwaddr function return -ENOSYS and -ENOSYS otherwise.
> 
> In this case we can simplify this by just returning the result of the
> function.
> 
> Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
> ---
> Changes since v1:
>   Check pdata for NULL before dereferencing.
> 
>  drivers/net/zynq_gem.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
> index 86dd03feda..52beedfad0 100644
> --- a/drivers/net/zynq_gem.c
> +++ b/drivers/net/zynq_gem.c
> @@ -589,14 +589,12 @@ __weak int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
>  
>  static int zynq_gem_read_rom_mac(struct udevice *dev)
>  {
> -	int retval;
>  	struct eth_pdata *pdata = dev_get_platdata(dev);
>  
> -	retval = zynq_board_read_rom_ethaddr(pdata->enetaddr);
> -	if (retval == -ENOSYS)
> -		retval = 0;
> +	if (!pdata)
> +		return -ENOSYS;
>  
> -	return retval;
> +	return zynq_board_read_rom_ethaddr(pdata->enetaddr);
>  }
>  
>  static int zynq_gem_miiphy_read(struct mii_dev *bus, int addr,
> 

I have seen one series about mac address which should just replace the
whole this function. Not sure if it was applied or not but worth to
check because if this is in tree the whole this function should go away.

M

  parent reply	other threads:[~2017-04-05  6:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03 14:18 [U-Boot] [PATCHv2] net: zynq_gem: Do not return -ENOSYS on success Olliver Schinagl
2017-04-04 17:53 ` Joe Hershberger
2017-04-05  9:17   ` Michal Simek
2017-04-10 22:17     ` Joe Hershberger
2017-04-05  6:29 ` Michal Simek [this message]
2017-04-05  9:14   ` Olliver Schinagl
2017-06-02 19:48 ` [U-Boot] " Joe Hershberger

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=1077f359-cce7-bdca-086a-aba90aee5f3d@xilinx.com \
    --to=michal.simek@xilinx.com \
    --cc=u-boot@lists.denx.de \
    /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.