From patchwork Thu Dec 3 22:31:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 336953 Delivered-To: patch@linaro.org Received: by 2002:a92:5e16:0:0:0:0:0 with SMTP id s22csp674402ilb; Thu, 3 Dec 2020 14:32:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJygPTaTn3WYxvOTu3N5V55kOZcVvxqEIU+EvVjuP/p/G4DDHKUSScvAI03PbfkNE7mfLPvw X-Received: by 2002:a50:c40d:: with SMTP id v13mr4890400edf.1.1607034748384; Thu, 03 Dec 2020 14:32:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607034748; cv=none; d=google.com; s=arc-20160816; b=gm/LBlkog+SKJdFkzwY6ypWN477knJucGRb/aqcN4MuuzzHsLhaiPqcqjU8nwBnC9p xpyLO64xq5dJ/lzZLUqRE2aLXVWlJZr+qo5IQysyGvqNeSuk36cgTmKzRjiNW1ducU1L yak3oWpCozk8paKT6oY4rEk7fBz1gvdoL7BpwmEGV6lgC+JjvKsNXEiPcP5Ml1MPtJ98 UjojSxKA8doZtRKXsRB4dX0gCyTGG1u2W0QCt0iwBwbceX95YrfVcgpHqXhSeaFXXKci SDaiLSEKyj9sulXZ7EvsE/oSHs0/canIe9Loshg90DlzqteZxY9PHNLvFvqdvuO92hwh cVjA== 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=ZXLs9vyVoW649yzq6RZ9Qv1YtKnaM6AfYNn4K28tgYv2vfqRxRQlobZo0f0uF3idPo I24BJ3J3i3Kkmzqr3oBqt1WxD8MZwMIoXaHEafJ+Yc5z0c6/9OEc++EeymoZ0ukOnSM4 rdPmOYjGkYp2NxGF2X5d3dvU2oOrWZcyRbUhh2hOaS/Xmdlv3r0wGEuwPRzW9GCUeX8M cj5ciz2XeJKR0On3agSP321xdK9/mG/NBSbxLFAu3EORe85Y/usUTsPd89ay1774ZVcF LC5tHYmAqWq4Khv1hS2wi0sRNzco9oM53pscjiapkQ3NjtVfm98AmEqn87LicZ3QinmB FPPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-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 x60si1782756ede.80.2020.12.03.14.32.28 for ; Thu, 03 Dec 2020 14:32:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-scsi-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-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-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 S1728252AbgLCWcX (ORCPT ); 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 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@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(-) -- 2.27.0 Reviewed-by: Avri Altman Reviewed-by: Avri Altman 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)) {