Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -207,10 +207,12 @@ EXPORT_SYMBOL(blk_post_runtime_resume);
 */
void blk_set_runtime_active(struct request_queue *q)
{
	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);