]> www.infradead.org Git - users/jedix/linux-maple.git/commit
scsi: ufs: core: Make ufshcd_uic_cmd_compl() easier to analyze
authorBart Van Assche <bvanassche@acm.org>
Thu, 12 Sep 2024 22:30:04 +0000 (15:30 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 4 Oct 2024 01:34:43 +0000 (21:34 -0400)
commitfcd8b0450a9acbf3f0e88d749a72ef932df97663
treecc1b334f2d9b1717db6944f3471cfaf3467f8fc9
parente31931d646d3bc2223d9a275bac9cdc4963c5bc1
scsi: ufs: core: Make ufshcd_uic_cmd_compl() easier to analyze

In ufshcd_uic_cmd_compl(), there is code that dereferences 'cmd' with
and without checking the 'cmd' pointer. This confuses static source code
analyzers like Coverity and sparse. Since none of the code in
ufshcd_uic_cmd_compl() can do anything useful if 'cmd' is NULL, move the
'cmd' test near the start of this function.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240912223019.3510966-4-bvanassche@acm.org
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Reviewed-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/core/ufshcd.c