scsi: ufs: Fix -Wsometimes-uninitialized warning
authorArnd Bergmann <arnd@arndb.de>
Thu, 3 Dec 2020 22:31:26 +0000 (23:31 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 8 Dec 2020 01:29:55 +0000 (20:29 -0500)
clang complains about a possible code path in which a variable is used
without an initialization:

drivers/scsi/ufs/ufshcd.c:7690:3: error: variable 'sdp' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
                BUG_ON(1);
                ^~~~~~~~~
include/asm-generic/bug.h:63:36: note: expanded from macro 'BUG_ON'
 #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
                                   ^~~~~~~~~~~~~~~~~~~

Turn the BUG_ON(1) into an unconditional BUG() that makes it clear to clang
that this code path is never hit.

Link: https://lore.kernel.org/r/20201203223137.1205933-1-arnd@kernel.org
Fixes: 4f3e900b6282 ("scsi: ufs: Clear UAC for FFU and RPMB LUNs")
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c

index a41ee9cd26bad04a9c172c6dc4ce58fdca492f95..c1c401b2b69d06bf8b6634bdd17715c093f9aef9 100644 (file)
@@ -7705,7 +7705,7 @@ static int ufshcd_clear_ua_wlun(struct ufs_hba *hba, u8 wlun)
        else if (wlun == UFS_UPIU_RPMB_WLUN)
                sdp = hba->sdev_rpmb;
        else
-               BUG_ON(1);
+               BUG();
        if (sdp) {
                ret = scsi_device_get(sdp);
                if (!ret && !scsi_device_online(sdp)) {