[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fe740e46-6cd2-4a54-9802-0ec771ecb213@intel.com>
Date: Fri, 29 Aug 2025 14:15:26 -0700
From: Jacob Keller <jacob.e.keller@...el.com>
To: Stefan Wahren <wahrenst@....net>, Parthiban Veerasooran
<parthiban.veerasooran@...rochip.com>, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
CC: <linux-spi@...r.kernel.org>, <netdev@...r.kernel.org>,
<stable@...nel.org>, Andrew Lunn <andrew@...n.ch>
Subject: Re: [PATCH V2 1/3 net] net: ethernet: oa_tc6: Handle failure of
spi_setup
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@....net>
> Cc: stable@...nel.org
> Reviewed-by: Andrew Lunn <andrew@...n.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@...el.com>
> tc6->spi_ctrl_tx_buf = devm_kzalloc(&tc6->spi->dev,
> OA_TC6_CTRL_SPI_BUF_SIZE,
Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (237 bytes)
Powered by blists - more mailing lists