Commit 8a15b4d7 authored by Stanley Chu's avatar Stanley Chu Committed by Jens Axboe

block: bypass blk_set_runtime_active for uninitialized q->dev

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: default avatarStanley Chu <stanley.chu@mediatek.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent f7c4ce89
...@@ -207,10 +207,12 @@ EXPORT_SYMBOL(blk_post_runtime_resume); ...@@ -207,10 +207,12 @@ EXPORT_SYMBOL(blk_post_runtime_resume);
*/ */
void blk_set_runtime_active(struct request_queue *q) void blk_set_runtime_active(struct request_queue *q)
{ {
if (q->dev) {
spin_lock_irq(&q->queue_lock); spin_lock_irq(&q->queue_lock);
q->rpm_status = RPM_ACTIVE; q->rpm_status = RPM_ACTIVE;
pm_runtime_mark_last_busy(q->dev); pm_runtime_mark_last_busy(q->dev);
pm_request_autosuspend(q->dev); pm_request_autosuspend(q->dev);
spin_unlock_irq(&q->queue_lock); spin_unlock_irq(&q->queue_lock);
}
} }
EXPORT_SYMBOL(blk_set_runtime_active); EXPORT_SYMBOL(blk_set_runtime_active);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment