summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2021-04-15 15:08:22 -0700
committerMartin K. Petersen <martin.petersen@oracle.com>2021-04-15 22:44:41 -0400
commit41e70e3006f63b89ae3b0d49557ac9f620bac524 (patch)
tree4551ce6d7166861e42d4adc3cb23b30406cf50e6 /drivers
parent22dc227e8f0e913d86552f5714fccb0e622ec650 (diff)
downloadlinux-41e70e3006f63b89ae3b0d49557ac9f620bac524.tar.bz2
scsi: sd: Introduce a new local variable in sd_check_events()
Instead of using 'retval' to represent first a SCSI status and later whether or not a disk change event occurred, introduce a new variable for the latter purpose. Link: https://lore.kernel.org/r/20210415220826.29438-17-bvanassche@acm.org Cc: Christoph Hellwig <hch@lst.de> Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com> Cc: Hannes Reinecke <hare@suse.de> Cc: Daniel Wagner <dwagner@suse.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/sd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 91c34ee972c7..cb3c37d1e009 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1623,6 +1623,7 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing)
struct scsi_disk *sdkp = scsi_disk_get(disk);
struct scsi_device *sdp;
int retval;
+ bool disk_changed;
if (!sdkp)
return 0;
@@ -1680,10 +1681,10 @@ out:
* Medium present state has changed in either direction.
* Device has indicated UNIT_ATTENTION.
*/
- retval = sdp->changed ? DISK_EVENT_MEDIA_CHANGE : 0;
+ disk_changed = sdp->changed;
sdp->changed = 0;
scsi_disk_put(sdkp);
- return retval;
+ return disk_changed ? DISK_EVENT_MEDIA_CHANGE : 0;
}
static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr)