[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240705082057.3006342-1-nichen@iscas.ac.cn>
Date: Fri, 5 Jul 2024 16:20:57 +0800
From: Chen Ni <nichen@...as.ac.cn>
To: dmitry.torokhov@...il.com,
u.kleine-koenig@...gutronix.de,
Jonathan.Cameron@...wei.com,
broonie@...nel.org
Cc: linux-input@...r.kernel.org,
linux-kernel@...r.kernel.org,
Chen Ni <nichen@...as.ac.cn>
Subject: [PATCH] Input: pxspad - add check for spi_setup
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/input/joystick/psxpad-spi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/input/joystick/psxpad-spi.c b/drivers/input/joystick/psxpad-spi.c
index c47fc5f34bd0..5b53d43c797a 100644
--- a/drivers/input/joystick/psxpad-spi.c
+++ b/drivers/input/joystick/psxpad-spi.c
@@ -344,7 +344,11 @@ static int psxpad_spi_probe(struct spi_device *spi)
/* (PlayStation 1/2 joypad might be possible works 250kHz/500kHz) */
spi->controller->min_speed_hz = 125000;
spi->controller->max_speed_hz = 125000;
- spi_setup(spi);
+ err = spi_setup(spi);
+ if (err < 0) {
+ dev_err(&spi->dev, "failed to set up spi: %d\n", err);
+ return err;
+ }
/* pad settings */
psxpad_set_motor_level(pad, 0, 0);
--
2.25.1
Powered by blists - more mailing lists