netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Stefan Wahren <wahrenst@gmx.net>,
	Parthiban Veerasooran <parthiban.veerasooran@microchip.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: <linux-spi@vger.kernel.org>, <netdev@vger.kernel.org>,
	<stable@kernel.org>, Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH V2 1/3 net] net: ethernet: oa_tc6: Handle failure of spi_setup
Date: Fri, 29 Aug 2025 14:15:26 -0700	[thread overview]
Message-ID: <fe740e46-6cd2-4a54-9802-0ec771ecb213@intel.com> (raw)
In-Reply-To: <20250827115341.34608-2-wahrenst@gmx.net>


[-- Attachment #1.1: Type: text/plain, Size: 1409 bytes --]



On 8/27/2025 4:53 AM, Stefan Wahren wrote:
> There is no guarantee that spi_setup succeed, so properly handle
> the error case.
> 
> Fixes: aa58bec064ab ("net: ethernet: oa_tc6: implement register write operation")
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> Cc: stable@kernel.org
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> ---
>  drivers/net/ethernet/oa_tc6.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c
> index db200e4ec284..91a906a7918a 100644
> --- a/drivers/net/ethernet/oa_tc6.c
> +++ b/drivers/net/ethernet/oa_tc6.c
> @@ -1249,7 +1249,8 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev)
>  
>  	/* Set the SPI controller to pump at realtime priority */
>  	tc6->spi->rt = true;
> -	spi_setup(tc6->spi);
> +	if (spi_setup(tc6->spi) < 0)
> +		return NULL;
>  

Was thinking this could maybe be a pointer error, but the rest of the
function only returns NULL, and that means callers aren't prepped to
handle such error pointers. Ok.

I would note that many of the other errors flows come with some logging
to indicate what failed, but I don't think thats critical for this fix.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

>  	tc6->spi_ctrl_tx_buf = devm_kzalloc(&tc6->spi->dev,
>  					    OA_TC6_CTRL_SPI_BUF_SIZE,


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

  reply	other threads:[~2025-08-29 21:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-27 11:53 [PATCH V2 0/3 net] microchip: lan865x: Fix probing issues Stefan Wahren
2025-08-27 11:53 ` [PATCH V2 1/3 net] net: ethernet: oa_tc6: Handle failure of spi_setup Stefan Wahren
2025-08-29 21:15   ` Jacob Keller [this message]
2025-08-27 11:53 ` [PATCH V2 2/3 net] microchip: lan865x: Fix module autoloading Stefan Wahren
2025-08-29 21:19   ` Jacob Keller
2025-08-27 11:53 ` [PATCH V2 3/3 net] microchip: lan865x: Fix LAN8651 autoloading Stefan Wahren
2025-08-29 21:20   ` Jacob Keller
2025-08-30  2:50 ` [PATCH V2 0/3 net] microchip: lan865x: Fix probing issues patchwork-bot+netdevbpf

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=fe740e46-6cd2-4a54-9802-0ec771ecb213@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=parthiban.veerasooran@microchip.com \
    --cc=stable@kernel.org \
    --cc=wahrenst@gmx.net \
    /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).