From patchwork Wed Sep 11 06:32:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanley Chu X-Patchwork-Id: 11140341 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ACF181395 for ; Wed, 11 Sep 2019 06:32:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8B80221D7B for ; Wed, 11 Sep 2019 06:32:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726890AbfIKGc4 (ORCPT ); Wed, 11 Sep 2019 02:32:56 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:37297 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726847AbfIKGcz (ORCPT ); Wed, 11 Sep 2019 02:32:55 -0400 X-UUID: 32b74ff3b1b84bbfaf570c8b034cc1e7-20190911 X-UUID: 32b74ff3b1b84bbfaf570c8b034cc1e7-20190911 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 187059210; Wed, 11 Sep 2019 14:32:47 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 11 Sep 2019 14:32:46 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 11 Sep 2019 14:32:46 +0800 From: Stanley Chu To: , , , , , CC: , , , , , , Stanley Chu Subject: [PATCH v1 1/2] block: bypass blk_set_runtime_active for uninitialized q->dev Date: Wed, 11 Sep 2019 14:32:41 +0800 Message-ID: <1568183562-18241-2-git-send-email-stanley.chu@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1568183562-18241-1-git-send-email-stanley.chu@mediatek.com> References: <1568183562-18241-1-git-send-email-stanley.chu@mediatek.com> MIME-Version: 1.0 X-MTK: N Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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 --- block/blk-pm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/blk-pm.c b/block/blk-pm.c index 0a028c189897..56ed94f7a2a3 100644 --- a/block/blk-pm.c +++ b/block/blk-pm.c @@ -207,6 +207,9 @@ EXPORT_SYMBOL(blk_post_runtime_resume); */ void blk_set_runtime_active(struct request_queue *q) { + if (!q->dev) + return; + spin_lock_irq(&q->queue_lock); q->rpm_status = RPM_ACTIVE; pm_runtime_mark_last_busy(q->dev);