aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2025-01-11 11:42:48 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2025-01-11 11:42:48 -0800
commitb62cef9a5c673f1b8083159f5dc03c1c5daced2f (patch)
tree27ab0f4eea05cf415bc174186613aaeee3d15385
parentMerge tag 'block-6.13-20250111' of git://git.kernel.dk/linux (diff)
parenthwmon: (drivetemp) Fix driver producing garbage data when SCSI errors occur (diff)
downloadwireguard-linux-b62cef9a5c673f1b8083159f5dc03c1c5daced2f.tar.xz
wireguard-linux-b62cef9a5c673f1b8083159f5dc03c1c5daced2f.zip
Merge tag 'hwmon-for-v6.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon fix from Guenter Roeck: "One patch to fix error handling in drivetemp driver" * tag 'hwmon-for-v6.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (drivetemp) Fix driver producing garbage data when SCSI errors occur
Diffstat (limited to '')
-rw-r--r--drivers/hwmon/drivetemp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/hwmon/drivetemp.c b/drivers/hwmon/drivetemp.c
index 6bdd21aa005a..2a4ec55ddb47 100644
--- a/drivers/hwmon/drivetemp.c
+++ b/drivers/hwmon/drivetemp.c
@@ -165,6 +165,7 @@ static int drivetemp_scsi_command(struct drivetemp_data *st,
{
u8 scsi_cmd[MAX_COMMAND_SIZE];
enum req_op op;
+ int err;
memset(scsi_cmd, 0, sizeof(scsi_cmd));
scsi_cmd[0] = ATA_16;
@@ -192,8 +193,11 @@ static int drivetemp_scsi_command(struct drivetemp_data *st,
scsi_cmd[12] = lba_high;
scsi_cmd[14] = ata_command;
- return scsi_execute_cmd(st->sdev, scsi_cmd, op, st->smartdata,
- ATA_SECT_SIZE, HZ, 5, NULL);
+ err = scsi_execute_cmd(st->sdev, scsi_cmd, op, st->smartdata,
+ ATA_SECT_SIZE, HZ, 5, NULL);
+ if (err > 0)
+ err = -EIO;
+ return err;
}
static int drivetemp_ata_command(struct drivetemp_data *st, u8 feature,