sd: get disk reference in sd_check_events()
am: ea240cfed9
Change-Id: Ie5d8f2f3588859d8a4f4466c158223afbf8e2ecb
This commit is contained in:
commit
fbf3cf0c83
1 changed files with 7 additions and 2 deletions
|
@ -1398,11 +1398,15 @@ static int media_not_present(struct scsi_disk *sdkp,
|
||||||
**/
|
**/
|
||||||
static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing)
|
static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing)
|
||||||
{
|
{
|
||||||
struct scsi_disk *sdkp = scsi_disk(disk);
|
struct scsi_disk *sdkp = scsi_disk_get(disk);
|
||||||
struct scsi_device *sdp = sdkp->device;
|
struct scsi_device *sdp;
|
||||||
struct scsi_sense_hdr *sshdr = NULL;
|
struct scsi_sense_hdr *sshdr = NULL;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
|
if (!sdkp)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
sdp = sdkp->device;
|
||||||
SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_check_events\n"));
|
SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_check_events\n"));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1459,6 +1463,7 @@ out:
|
||||||
kfree(sshdr);
|
kfree(sshdr);
|
||||||
retval = sdp->changed ? DISK_EVENT_MEDIA_CHANGE : 0;
|
retval = sdp->changed ? DISK_EVENT_MEDIA_CHANGE : 0;
|
||||||
sdp->changed = 0;
|
sdp->changed = 0;
|
||||||
|
scsi_disk_put(sdkp);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue