From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jens Axboe Subject: Re: [PATCH v1 1/2] block: bypass blk_set_runtime_active for uninitialized q->dev Date: Wed, 11 Sep 2019 16:13:16 -0600 Message-ID: <66fddf12-0dc4-1c73-affd-f8404e87342f@kernel.dk> References: <1568183562-18241-1-git-send-email-stanley.chu@mediatek.com> <1568183562-18241-2-git-send-email-stanley.chu@mediatek.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1568183562-18241-2-git-send-email-stanley.chu@mediatek.com> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Stanley Chu , linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, martin.petersen@oracle.com, jejb@linux.ibm.com, matthias.bgg@gmail.com Cc: andy.teng@mediatek.com, chun-hung.wu@mediatek.com, kuohong.wang@mediatek.com, linux-mediatek@lists.infradead.org, peter.wang@mediatek.com, linux-arm-kernel@lists.infradead.org List-Id: linux-mediatek@lists.infradead.org On 9/11/19 12:32 AM, Stanley Chu wrote: > 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); I'd prefer just doing: if (q->dev) { ... } instead. Other than that little complaint, looks good to me. -- Jens Axboe