netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Pavel Zhigulin <Pavel.Zhigulin@kaspersky.com>
Cc: Byungho An <bh74.an@samsung.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Siva Reddy <siva.kallam@samsung.com>,
	Girish K S <ks.giri@samsung.com>,
	Vipul Pandya <vipul.pandya@samsung.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <lvc-project@linuxtesting.org>
Subject: Re: [PATCH net] net: samsung: sxgbe: handle clk_prepare_enable() failures in sxgbe_open()
Date: Tue, 18 Nov 2025 18:31:22 -0800	[thread overview]
Message-ID: <20251118183122.6e74a6fa@kernel.org> (raw)
In-Reply-To: <20251114153616.3278623-1-Pavel.Zhigulin@kaspersky.com>

On Fri, 14 Nov 2025 18:36:14 +0300 Pavel Zhigulin wrote:
> sxgbe_open() didn't check result of clk_prepare_enable() call.
> 
> Add missing check
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: 1edb9ca69e8a ("net: sxgbe: add basic framework for Samsung 10Gb ethernet driver")
> Signed-off-by: Pavel Zhigulin <Pavel.Zhigulin@kaspersky.com>
> ---
>  drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
> index 75bad561b352..6b8e54391d7f 100644
> --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
> +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
> @@ -1063,7 +1063,12 @@ static int sxgbe_open(struct net_device *dev)
>  	struct sxgbe_priv_data *priv = netdev_priv(dev);
>  	int ret, queue_num;
> 
> -	clk_prepare_enable(priv->sxgbe_clk);
> +	ret = clk_prepare_enable(priv->sxgbe_clk);
> +	if (ret < 0) {
> +		netdev_err(dev, "%s: Cannot enable clock (error: %d)\n",
> +			   __func__, ret);
> +		goto clk_error;

Just:

		return ret;

no need for a goto here.

> +	}
> 
>  	sxgbe_check_ether_addr(priv);
> 
> @@ -1195,6 +1200,7 @@ static int sxgbe_open(struct net_device *dev)
>  phy_error:
>  	clk_disable_unprepare(priv->sxgbe_clk);
> 
> +clk_error:
>  	return ret;
>  }
-- 
pw-bot: cr

      reply	other threads:[~2025-11-19  2:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-14 15:36 [PATCH net] net: samsung: sxgbe: handle clk_prepare_enable() failures in sxgbe_open() Pavel Zhigulin
2025-11-19  2:31 ` Jakub Kicinski [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=20251118183122.6e74a6fa@kernel.org \
    --to=kuba@kernel.org \
    --cc=Pavel.Zhigulin@kaspersky.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bh74.an@samsung.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=ks.giri@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=siva.kallam@samsung.com \
    --cc=vipul.pandya@samsung.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;
as well as URLs for NNTP newsgroup(s).