[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240705084612.GA110803@aspen.lan>
Date: Fri, 5 Jul 2024 09:46:12 +0100
From: Daniel Thompson <daniel.thompson@...aro.org>
To: Chen Ni <nichen@...as.ac.cn>
Cc: lee@...nel.org, jingoohan1@...il.com, deller@....de,
dri-devel@...ts.freedesktop.org, linux-fbdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] backlight: l4f00242t03: Add check for spi_setup
On Fri, Jul 05, 2024 at 04:38:34PM +0800, Chen Ni wrote:
> Add check for the return value of spi_setup() and return the error
> if it fails in order to catch the error.
>
> Signed-off-by: Chen Ni <nichen@...as.ac.cn>
> ---
> drivers/video/backlight/l4f00242t03.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c
> index dd0874f8c7ff..a4e27adee8ac 100644
> --- a/drivers/video/backlight/l4f00242t03.c
> +++ b/drivers/video/backlight/l4f00242t03.c
> @@ -166,6 +166,7 @@ static const struct lcd_ops l4f_ops = {
> static int l4f00242t03_probe(struct spi_device *spi)
> {
> struct l4f00242t03_priv *priv;
> + int ret;
>
> priv = devm_kzalloc(&spi->dev, sizeof(struct l4f00242t03_priv),
> GFP_KERNEL);
> @@ -174,7 +175,9 @@ static int l4f00242t03_probe(struct spi_device *spi)
>
> spi_set_drvdata(spi, priv);
> spi->bits_per_word = 9;
> - spi_setup(spi);
> + ret = spi_setup(spi);
> + if (ret < 0)
> + return ret;
Good change but please add a dev_err_probe() here to match the other
error paths in this function.
Daniel.
Powered by blists - more mailing lists