diff options
| -rw-r--r-- | drivers/ata/libata-scsi.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index a6df6a351d6e..7c337e754dab 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
| @@ -309,7 +309,8 @@ ata_scsi_activity_show(struct device *dev, struct device_attribute *attr, | |||
| 309 | struct ata_port *ap = ata_shost_to_port(sdev->host); | 309 | struct ata_port *ap = ata_shost_to_port(sdev->host); |
| 310 | struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); | 310 | struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); |
| 311 | 311 | ||
| 312 | if (ap->ops->sw_activity_show && (ap->flags & ATA_FLAG_SW_ACTIVITY)) | 312 | if (atadev && ap->ops->sw_activity_show && |
| 313 | (ap->flags & ATA_FLAG_SW_ACTIVITY)) | ||
| 313 | return ap->ops->sw_activity_show(atadev, buf); | 314 | return ap->ops->sw_activity_show(atadev, buf); |
| 314 | return -EINVAL; | 315 | return -EINVAL; |
| 315 | } | 316 | } |
| @@ -324,7 +325,8 @@ ata_scsi_activity_store(struct device *dev, struct device_attribute *attr, | |||
| 324 | enum sw_activity val; | 325 | enum sw_activity val; |
| 325 | int rc; | 326 | int rc; |
| 326 | 327 | ||
| 327 | if (ap->ops->sw_activity_store && (ap->flags & ATA_FLAG_SW_ACTIVITY)) { | 328 | if (atadev && ap->ops->sw_activity_store && |
| 329 | (ap->flags & ATA_FLAG_SW_ACTIVITY)) { | ||
| 328 | val = simple_strtoul(buf, NULL, 0); | 330 | val = simple_strtoul(buf, NULL, 0); |
| 329 | switch (val) { | 331 | switch (val) { |
| 330 | case OFF: case BLINK_ON: case BLINK_OFF: | 332 | case OFF: case BLINK_ON: case BLINK_OFF: |
