Message ID | 20240215131603.2062332-1-colin.i.king@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-66964-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp395955dyb; Thu, 15 Feb 2024 05:26:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU91AHhabSij5lMmxZRm2bRLyowTZFgZKxqkrLXtSpfoX6o8XoD4mQ84gTtiolChPKE7yYVdX1IauVjyk3CCnSUjxlOSA== X-Google-Smtp-Source: AGHT+IEB9jYW4W/VuIPXZFwYACvYZtSd0WAKt7oIqM3l5w10voihBBLlE9cva5LznkR6jO6Z5J3F X-Received: by 2002:a17:906:7c46:b0:a3b:e975:c530 with SMTP id g6-20020a1709067c4600b00a3be975c530mr1383756ejp.51.1708003590063; Thu, 15 Feb 2024 05:26:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708003590; cv=pass; d=google.com; s=arc-20160816; b=c1rnoB1cwTtLpEFrh8MLbqoB4UOfbBTKrnCsCoY3l8ZYQrZrhU+FQgPNgOtAGcYVy+ rx78ugSJP7Vwc/KLWjEcQdibqglyBFT8j6MugVd1XkiyHCilZ+MjVmi75HRK9GGQ5BfG KOAzM7o+kEz/ezTXoNGO3/To/ncZRNfuNiUQZF6gO8cQeEk906saTBjPkU2vAavwJslv AxbhuFzZ03Vna9g0EQW4tEpxLk91IFVq6F9WjZ/lncQJFKVfTz/Ni98bWn4OY1nqdd5W /TGDNGD9ZIyHntvNGuYTxjaFFVTkrkopzHNuCXMhDk3rBHeVTPDZJNG9/QC5bUThq3qY Krag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=IeBmJwr+NavRsk9se4OE6Y3WMAt4IgfjmriUd2t4/J8=; fh=w48kgHWH0WYd+7tuVHKhZhaimthdltN/IZM+v+5qOpY=; b=vEiuWbjXiv25rz48HjbV0JfqAIjGbxOEjPd5cleTwVp713AUDUNFrGG2xfDY2rqY1a UjQnjlpkY54GEbeNxVBh6uojqGuU3sBW7e0IxqE8hy0Qx4Lm34A7AoInw9eXvk6exmEg e0pw/emjBphxNguVQJNSZaj7FXSwivZST/CW+NnAELjARIU2jzdBtwCiM0+gvLdcM3hr iBuXLdxJ3saFOXULhwHuyxDCxiZ1ts6vep33SGdy9J7XpFL5vhC9oaj94RvNIpXFI4q2 jJfbRRXwJAr5Y7yA9rsM1M40/fGO1eBU6UXcDKfVb6i9rEx7vv21f0Y5tOUXQgLTBFLH hiaA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="FC/fPhSz"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-66964-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66964-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t26-20020a17090616da00b00a3cf5869e2dsi643062ejd.648.2024.02.15.05.26.29 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 05:26:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66964-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="FC/fPhSz"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-66964-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66964-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id F26691F29CBA for <ouuuleilei@gmail.com>; Thu, 15 Feb 2024 13:16:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 40C7D130AD1; Thu, 15 Feb 2024 13:16:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FC/fPhSz" Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D48012CDBE; Thu, 15 Feb 2024 13:16:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708002968; cv=none; b=bpqJnC2yMSdEgiyjKnQBHXl3PkevbfzIWOlma9zj2toIziNvj6S/9ViA100gTxcapS2j+1ne5paEb3kYacAgGKvke5YG/qL+ry2YX8+S6QfiX8na9RtA9jYUMpjxSSbpkRwnBaiL/DcntxqBK/WssqEfzsaV24Vvl3z4I1p427I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708002968; c=relaxed/simple; bh=ZMcH2cl5HrhWXR1rAuN3t1R9ANzFaFtZb+vIKIdyJjA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=nyvCLuYYyZ6m+JK6mGi8wiGCppezcoVf69ND4nvVbjtkkh67XsqNbwIJfJwqTP38sjQQaXkw2o69qjSWDcoj5beCR5CMqf6tmH/gt6qUYtLw7nVtzBMa/4oJxCKipc68jcm5sHAgWvJ0Jdc3DSk/Zl76fpjNjhJfSmCJcdX0aYk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FC/fPhSz; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-411e5f21c0bso7381605e9.0; Thu, 15 Feb 2024 05:16:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708002965; x=1708607765; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=IeBmJwr+NavRsk9se4OE6Y3WMAt4IgfjmriUd2t4/J8=; b=FC/fPhSzmFYwocM5/rRGynGlOuyg3CLsaBj5jhFj7okhsDU/wZtjqS1+lOt49PV/vx wZC0P/6kNLmEryT4jkOS6+emGQULU3gXAfKoc2/ZpF/Y5UmA6YX9k0QAS3fUOscLcEBu Qab5/O4Z/6nqtq2pk/t50drRCAEOMfL2T4ZFzMUkq7ZLAEZjhlJGukqA21NVl6SiNKO9 +MWI3aNbw8VFo1PkQDSzPP3JgifEvgaUN1vt3J3Aq3oU/emm4g4/Y9SED01hcMSQ5AOj b0ljT02Fi4PZPppQxDlkOLeuN+Jdku2sCIiaRLCmx+iwoXFD+/+W5PIUgEZ61CZuCk18 Es5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708002965; x=1708607765; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IeBmJwr+NavRsk9se4OE6Y3WMAt4IgfjmriUd2t4/J8=; b=vaiTXGuXSXaI+rnj5dPc+2xVt37PffGqar/kEjGOnkKjTefAZG9etNfMoJhWLPQhre v3ELrTI74xUM+b3joaBpmFEtMi8J+9tw18teRHV35vVxCZR+u9BG7dj+MpTvWjp8Pyhg yboYkXUgF652KzVo3X7IpO5nsdCUaPdACbgHdjlLyxwRZOR1dWBMok+nqRJWVLE1Ls9F Lc9miKWHdP4oFpxduLpNkMpOIo8egVQIdbxtoy8pILU4JeWDEu+FIx5ZcmSGfy0HcxUU qhKBCyHZifRPTstQ0nsPh2FXnes5qVBrLXPcLZnp4ngD+CzsNdOdGA2HAEBX7QFAxpLg 0O6A== X-Forwarded-Encrypted: i=1; AJvYcCXj91uNSe8Jc6L/RzxU9dnmh6voWJAkrRdqwvzVeRmCfgA9MNCPS8PFLqTlYKLFkdWDpxqR28DQH7D5Y89BFkqzIW0PQKW3Biz4T6SmuMxwQbvP2949idkT03mno8thnVtdPwPbwUQM X-Gm-Message-State: AOJu0YwcWIXW0aOI7/ibykcV9MoOJzBHi4MR1lkKqBfiQvuMudrDVzIi k7y9kso6k53xusoFNvXYzUBKBw69kUxQ85GubjQ+u/DI8NDcdLGE X-Received: by 2002:a05:600c:46cd:b0:410:cf60:d857 with SMTP id q13-20020a05600c46cd00b00410cf60d857mr1331806wmo.18.1708002965162; Thu, 15 Feb 2024 05:16:05 -0800 (PST) Received: from localhost (cpc154979-craw9-2-0-cust193.16-3.cable.virginm.net. [80.193.200.194]) by smtp.gmail.com with ESMTPSA id q25-20020a7bce99000000b00411e1574f7fsm5011002wmj.44.2024.02.15.05.16.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 05:16:04 -0800 (PST) From: Colin Ian King <colin.i.king@gmail.com> To: Serge Semin <fancer.lancer@gmail.com>, Mark Brown <broonie@kernel.org>, linux-spi@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] spi: dw: remove redundant assignment to variable len Date: Thu, 15 Feb 2024 13:16:03 +0000 Message-Id: <20240215131603.2062332-1-colin.i.king@gmail.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790971452777003486 X-GMAIL-MSGID: 1790971572292713377 |
Series |
[next] spi: dw: remove redundant assignment to variable len
|
|
Commit Message
Colin Ian King
Feb. 15, 2024, 1:16 p.m. UTC
The variable id len being initialized with a value that is never read,
it is being re-assigned later on in a for-loop. The initialization is
redundant and can be removed.
Cleans up clang scan build warning:
drivers/spi/spi-dw-dma.c:580:17: warning: Although the value stored
to 'len' is used in the enclosing expression, the value is never
actually read from 'len' [deadcode.DeadStores]
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
drivers/spi/spi-dw-dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Thu, Feb 15, 2024 at 01:16:03PM +0000, Colin Ian King wrote: > The variable id len being initialized with a value that is never read, > it is being re-assigned later on in a for-loop. The initialization is > redundant and can be removed. > > Cleans up clang scan build warning: > drivers/spi/spi-dw-dma.c:580:17: warning: Although the value stored > to 'len' is used in the enclosing expression, the value is never > actually read from 'len' [deadcode.DeadStores] Don't know for sure now what was my original intention of having it pre-initialized in the for-loop init section. Possibly what you suggest to drop was a leftover from some another version of the function implementation where the re-initialization was required. On the other hand rather weak but still a justification of having that assignment can be a maintainability so all the basic loop variables would be safely pre-initialized before the code block is executed. But in that case a more correct value would have been "xfer->len" instead of zero. Anyway let's keep the code simple and drop the assignment. Thanks for the patch. Acked-by: Serge Semin <fancer.lancer@gmail.com> -Serge(y) > > Signed-off-by: Colin Ian King <colin.i.king@gmail.com> > --- > drivers/spi/spi-dw-dma.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/spi/spi-dw-dma.c b/drivers/spi/spi-dw-dma.c > index 0ecbb6c36e23..f4c209e5f52b 100644 > --- a/drivers/spi/spi-dw-dma.c > +++ b/drivers/spi/spi-dw-dma.c > @@ -577,7 +577,7 @@ static int dw_spi_dma_transfer_one(struct dw_spi *dws, > sg_init_table(&tx_tmp, 1); > sg_init_table(&rx_tmp, 1); > > - for (base = 0, len = 0; base < xfer->len; base += len) { > + for (base = 0; base < xfer->len; base += len) { > /* Fetch next Tx DMA data chunk */ > if (!tx_len) { > tx_sg = !tx_sg ? &xfer->tx_sg.sgl[0] : sg_next(tx_sg); > -- > 2.39.2 >
On Thu, 15 Feb 2024 13:16:03 +0000, Colin Ian King wrote: > The variable id len being initialized with a value that is never read, > it is being re-assigned later on in a for-loop. The initialization is > redundant and can be removed. > > Cleans up clang scan build warning: > drivers/spi/spi-dw-dma.c:580:17: warning: Although the value stored > to 'len' is used in the enclosing expression, the value is never > actually read from 'len' [deadcode.DeadStores] > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next Thanks! [1/1] spi: dw: remove redundant assignment to variable len commit: 125b28b18926e050e770160a5897b81082304f8c All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
diff --git a/drivers/spi/spi-dw-dma.c b/drivers/spi/spi-dw-dma.c index 0ecbb6c36e23..f4c209e5f52b 100644 --- a/drivers/spi/spi-dw-dma.c +++ b/drivers/spi/spi-dw-dma.c @@ -577,7 +577,7 @@ static int dw_spi_dma_transfer_one(struct dw_spi *dws, sg_init_table(&tx_tmp, 1); sg_init_table(&rx_tmp, 1); - for (base = 0, len = 0; base < xfer->len; base += len) { + for (base = 0; base < xfer->len; base += len) { /* Fetch next Tx DMA data chunk */ if (!tx_len) { tx_sg = !tx_sg ? &xfer->tx_sg.sgl[0] : sg_next(tx_sg);