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>
struct scsi_disk *sdkp = scsi_disk_get(disk);
struct scsi_device *sdp;
int retval;
+ bool disk_changed;
if (!sdkp)
return 0;
* 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)