Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC2A3C4332F for ; Sun, 29 Oct 2023 23:02:16 +0000 (UTC) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=GrJFT+xV; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4SJX3W3S9tz2xTl for ; Mon, 30 Oct 2023 10:02:15 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=GrJFT+xV; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2604:1380:40e1:4800::1; helo=sin.source.kernel.org; envelope-from=sashal@kernel.org; receiver=lists.ozlabs.org) Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4SJX286WPnz3cSN for ; Mon, 30 Oct 2023 10:01:04 +1100 (AEDT) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 82A8BCE1268; Sun, 29 Oct 2023 23:01:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EF1BC433C8; Sun, 29 Oct 2023 23:01:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698620462; bh=nefNvxaZGIfqqhRnyykqauUv1ya0p4ckjFquWYv42cw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GrJFT+xVsIshi7TjK31/Sq4pBiyNKgEu/59ZKzgUTJzy5Ae5TYHnV7YiaXqPyfk6l 2pLf13ZtZH+cyHFJ3a1YiMXgPVhVhn9TBAFHxr3u+Rpyh9Z+aDhQqcpc+SBBbffesX C1DzFxTdlQkWf23H5UM09YLZyFkNSObh2vopqcOiwQLUvycpV4peJS734Z1s0jSHP0 vQ6g12cbTGd1ex2ZONVZ5Th31KD5duc7cbG46H6FyaORlpXIcHrrQi+tk1ULLmcmvq CirLrz0/oLn0hFi7DIgjSRXIMzimqO0OsnaqAbmSxrDxlz9SR1GMJNDNIR8N74px+y Z3fyt7SgM6CNg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 02/13] spi: npcm-fiu: Fix UMA reads when dummy.nbytes == 0 Date: Sun, 29 Oct 2023 19:00:35 -0400 Message-ID: <20231029230057.792930-2-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231029230057.792930-1-sashal@kernel.org> References: <20231029230057.792930-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.4.259 Content-Transfer-Encoding: 8bit X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , tmaimon77@gmail.com, avifishman70@gmail.com, "William A. Kennington III" , openbmc@lists.ozlabs.org, tali.perry1@gmail.com, Mark Brown , linux-spi@vger.kernel.org Errors-To: openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Sender: "openbmc" From: "William A. Kennington III" [ Upstream commit 2ec8b010979036c2fe79a64adb6ecc0bd11e91d1 ] We don't want to use the value of ilog2(0) as dummy.buswidth is 0 when dummy.nbytes is 0. Since we have no dummy bytes, we don't need to configure the dummy byte bits per clock register value anyway. Signed-off-by: "William A. Kennington III" Link: https://lore.kernel.org/r/20230922182812.2728066-1-william@wkennington.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-npcm-fiu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-npcm-fiu.c b/drivers/spi/spi-npcm-fiu.c index 1e770d6739050..cc4e29cd86dab 100644 --- a/drivers/spi/spi-npcm-fiu.c +++ b/drivers/spi/spi-npcm-fiu.c @@ -334,8 +334,9 @@ static int npcm_fiu_uma_read(struct spi_mem *mem, uma_cfg |= ilog2(op->cmd.buswidth); uma_cfg |= ilog2(op->addr.buswidth) << NPCM_FIU_UMA_CFG_ADBPCK_SHIFT; - uma_cfg |= ilog2(op->dummy.buswidth) - << NPCM_FIU_UMA_CFG_DBPCK_SHIFT; + if (op->dummy.nbytes) + uma_cfg |= ilog2(op->dummy.buswidth) + << NPCM_FIU_UMA_CFG_DBPCK_SHIFT; uma_cfg |= ilog2(op->data.buswidth) << NPCM_FIU_UMA_CFG_RDBPCK_SHIFT; uma_cfg |= op->dummy.nbytes << NPCM_FIU_UMA_CFG_DBSIZ_SHIFT; -- 2.42.0