linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] backlight: l4f00242t03: Add check for spi_setup
@ 2024-07-05  8:38 Chen Ni
  2024-07-05  8:46 ` Daniel Thompson
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Ni @ 2024-07-05  8:38 UTC (permalink / raw)
  To: lee, daniel.thompson, jingoohan1, deller
  Cc: dri-devel, linux-fbdev, linux-kernel, Chen Ni

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@iscas.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;
 
 	priv->spi = spi;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] backlight: l4f00242t03: Add check for spi_setup
  2024-07-05  8:38 [PATCH] backlight: l4f00242t03: Add check for spi_setup Chen Ni
@ 2024-07-05  8:46 ` Daniel Thompson
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Thompson @ 2024-07-05  8:46 UTC (permalink / raw)
  To: Chen Ni; +Cc: lee, jingoohan1, deller, dri-devel, linux-fbdev, linux-kernel

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@iscas.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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-05  8:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-05  8:38 [PATCH] backlight: l4f00242t03: Add check for spi_setup Chen Ni
2024-07-05  8:46 ` Daniel Thompson

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).