Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp857402pxu; Thu, 3 Dec 2020 14:36:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3tiPHJctL53RDt3vaCmwwkvhpvf4h9xMJiVkDBWdQO66gMJP1pUOWrghlB2uMAmjVcjsC X-Received: by 2002:a50:fc11:: with SMTP id i17mr5014880edr.112.1607035001322; Thu, 03 Dec 2020 14:36:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607035001; cv=none; d=google.com; s=arc-20160816; b=F+TOrhXD3bMxf1/k3QKF4iDX6J1ODrkoOTbFV7yUvXIN4BiVrbJ2s6y0zrA7IQHQTR jwDXB7FeTQHQ5mRrwJbXN9WYtoCdU7p+FNtoGonrm5Wgr2Xh1BdIOi6tiaXzKkm9ppZU KH3/3l1OuTxCOlug++fjeT4WEW9+vIOiehGdjDsapNxS41kjY3+nsBtkZ8OKyYfOrbvB Z9VeRWBvuMTKtyL3oD6CjHcTPcpL3jM2ZD+5A4RrjAz+Q0CTc34+lw3bDnz0h+HN+00O HJ1jsPSWM7GxVQwwZnL5RWtYBQ+ZNA6XdsISm3Y+PJ2VixH4AECOZmw/JvIX288X6rWA 9VVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=mgXwATczP/mNTBAJAeCNKgUGxpQOFQCiky7B7MucNWU=; b=gmFYrXxpmnZ13IYGS/9U1l+g7GBByxpTo6N6/R4uCGn+vojhY72E2R4I1cVVfamuwO omXhKvKWGHrL6odhPxlljOz1Zd9TAj1j0T6iasDQYbNxqnvJYF5w53gu0hcUiiJbKaWh orlVoZ7hwSLJhRLo3p0uPYLbBxjRBOt1ppu/v/YHGUbRdNf66IMlg0iThq1ydHVKmoGO hbWi/v4uGPCC3GfFQxeuRa3EvUH1HMPXMamOMkTlo5m8dxmxBZEF4DgUvamFLlSW3J3s 4qETl4meqO+smnt8RVLUJJ2gIs/MYJ91oZ/2kaeaQek4GxDoeH6rTDEY/nmZXdfIzHap yWdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lr26si242682ejb.312.2020.12.03.14.36.19; Thu, 03 Dec 2020 14:36:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729722AbgLCWcX (ORCPT + 99 others); Thu, 3 Dec 2020 17:32:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:55496 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726208AbgLCWcX (ORCPT ); Thu, 3 Dec 2020 17:32:23 -0500 From: Arnd Bergmann Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: "James E.J. Bottomley" , "Martin K. Petersen" , Nathan Chancellor , Nick Desaulniers , Jaegeuk Kim Cc: Arnd Bergmann , Alim Akhtar , Avri Altman , Stanley Chu , Can Guo , Asutosh Das , Bean Huo , Bart Van Assche , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH] ufshcd: fix Wsometimes-uninitialized warning Date: Thu, 3 Dec 2020 23:31:26 +0100 Message-Id: <20201203223137.1205933-1-arnd@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann 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. Fixes: 4f3e900b6282 ("scsi: ufs: Clear UAC for FFU and RPMB LUNs") Signed-off-by: Arnd Bergmann --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index f165baee937f..b4f7c4263334 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -7687,7 +7687,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)) { -- 2.27.0