All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: liuhaoran <liuhaoran14@163.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org
Subject: Re: [PATCH] net: hsr: Add error handling in hsr_portdev_setup()
Date: Thu, 28 Sep 2023 15:05:55 +0200	[thread overview]
Message-ID: <20230928130555.GJ24230@kernel.org> (raw)
In-Reply-To: <20230923122402.33851-1-liuhaoran14@163.com>

On Sat, Sep 23, 2023 at 08:24:02PM +0800, liuhaoran wrote:
> This patch adds error-handling for the hsr_port_get_hsr()
> inside the hsr_portdev_setup().
> 
> Signed-off-by: liuhaoran <liuhaoran14@163.com>

Please sign off using your real name, which is commonly of the form:

	Signed-off-by: First Last <me@example.com>

Please consider targeting this against 'net' as it appears to be a bug fix.

	Subject: [PATCH net] ...

If not, please target the patch against net-next.

If so, please consider using including a fixes tag, immediately
above your Signed-off-by (and any other) tags.

This may be the correct tag, but I'm not completely sure.

Fixes: e0a4b99773d3 ("hsr: use upper/lower device infrastructure")

> ---
>  net/hsr/hsr_slave.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c
> index e5742f2a2d52..ac7d6bdef47e 100644
> --- a/net/hsr/hsr_slave.c
> +++ b/net/hsr/hsr_slave.c
> @@ -141,6 +141,10 @@ static int hsr_portdev_setup(struct hsr_priv *hsr, struct net_device *dev,
>  	}
>  
>  	master = hsr_port_get_hsr(hsr, HSR_PT_MASTER);
> +
> +	if (!master)
> +		return -ENODEV;

I think this needs to jump to an unwind label.

		goto fail_upper_dev_link;

But I also think the unwind label should be renamed.
to reflect what they do, rather than where they are called from.

-- 
pw-bot: changes-requested

      reply	other threads:[~2023-09-28 13:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-23 12:24 [PATCH] net: hsr: Add error handling in hsr_portdev_setup() liuhaoran
2023-09-28 13:05 ` Simon Horman [this message]

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=20230928130555.GJ24230@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=liuhaoran14@163.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 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.