Skip to content

Commit

Permalink
block: bypass blk_set_runtime_active for uninitialized q->dev
Browse files Browse the repository at this point in the history
Some devices may skip blk_pm_runtime_init() and have null pointer
in its request_queue->dev. For example, SCSI devices of UFS Well-Known
LUNs.

Currently the null pointer is checked by the user of
blk_set_runtime_active(), i.e., scsi_dev_type_resume(). It is better to
check it by blk_set_runtime_active() itself instead of by its users.

Signed-off-by: Stanley Chu <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Stanley Chu authored and axboe committed Sep 12, 2019
1 parent f7c4ce8 commit 8a15b4d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions block/blk-pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,12 @@ EXPORT_SYMBOL(blk_post_runtime_resume);
*/
void blk_set_runtime_active(struct request_queue *q)
{
spin_lock_irq(&q->queue_lock);
q->rpm_status = RPM_ACTIVE;
pm_runtime_mark_last_busy(q->dev);
pm_request_autosuspend(q->dev);
spin_unlock_irq(&q->queue_lock);
if (q->dev) {
spin_lock_irq(&q->queue_lock);
q->rpm_status = RPM_ACTIVE;
pm_runtime_mark_last_busy(q->dev);
pm_request_autosuspend(q->dev);
spin_unlock_irq(&q->queue_lock);
}
}
EXPORT_SYMBOL(blk_set_runtime_active);

0 comments on commit 8a15b4d

Please sign in to comment.