Skip to contentSkip to conversation

iio: ssp_sensors: fix error code in ssp_print_mcu_debug()

PATCH Applied Dan Carpenter 2 participants 2 messages Sep 14, 2021 – Sep 18, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: ssp_sensors: fix error code in ssp_print_mcu_debug()

The ssp_print_mcu_debug() function should return negative error codes on error. Returning "length" is meaningless. This change does not affect runtime because the callers only care about zero/non-zero.

Fixes 50dd64d57eee ("iio: common: ssp_sensors: Add sensorhub driver")
---
 drivers/iio/common/ssp_sensors/ssp_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/common/ssp_sensors/ssp_spi.c +1 -1
index 4864c38b8d1c..77449b4f3df5 100644
@@ -137,7 +137,7 @@ static int ssp_print_mcu_debug(char *data_frame, int *data_index,
 	if (length > received_len - *data_index || length <= 0) {
 		ssp_dbg("[SSP]: MSG From MCU-invalid debug length(%d/%d)\n",
 			length, received_len);
-		return length ? length : -EPROTO;
+		return -EPROTO;
 	}
 
 	ssp_dbg("[SSP]: MSG From MCU - %s\n", &data_frame[*data_index]);
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw
Quoted 7 lines · On Tue, 14 Sep 2021 13:53:33 +0300 Dan Carpenter <[email protected]>…

The ssp_print_mcu_debug() function should return negative error codes on error. Returning "length" is meaningless. This change does not affect runtime because the callers only care about zero/non-zero.

Fixes 50dd64d57eee ("iio: common: ssp_sensors: Add sensorhub driver")

Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,

Jonathan

Quoted 17 lines
---
 drivers/iio/common/ssp_sensors/ssp_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/common/ssp_sensors/ssp_spi.c +1 -1
index 4864c38b8d1c..77449b4f3df5 100644
@@ -137,7 +137,7 @@ static int ssp_print_mcu_debug(char *data_frame, int *data_index,
 	if (length > received_len - *data_index || length <= 0) {
 		ssp_dbg("[SSP]: MSG From MCU-invalid debug length(%d/%d)\n",
 			length, received_len);
-		return length ? length : -EPROTO;
+		return -EPROTO;
 	}
 
 	ssp_dbg("[SSP]: MSG From MCU - %s\n", &data_frame[*data_index]);