]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
Staging: rts5208: Fix error handling on rtsx_send_cmd
authorAditya Pakki <pakki001@umn.edu>
Sat, 5 Jan 2019 14:14:41 +0000 (08:14 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Jan 2019 10:28:15 +0000 (11:28 +0100)
In sd_execute_write_data, the rtsx_send_cmd could fail with ETIMEDOUT
or EIO. The fix adds a check to handle these failures.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rts5208/sd.c

index 2c47ae613ea1f2a2eba518480f7652254c04d131..c256a2398651c007303082286304a3158cf3b002 100644 (file)
@@ -4437,7 +4437,12 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip)
                rtsx_init_cmd(chip);
                rtsx_add_cmd(chip, CHECK_REG_CMD, 0xFD30, 0x02, 0x02);
 
-               rtsx_send_cmd(chip, SD_CARD, 250);
+               retval = rtsx_send_cmd(chip, SD_CARD, 250);
+               if (retval < 0) {
+                       write_err = true;
+                       rtsx_clear_sd_error(chip);
+                       goto sd_execute_write_cmd_failed;
+               }
 
                retval = sd_update_lock_status(chip);
                if (retval != STATUS_SUCCESS) {