All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: lpddr_cmds: remove unused words variable
@ 2023-03-28  0:06 ` Tom Rix
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rix @ 2023-03-28  0:06 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr, nathan, ndesaulniers
  Cc: linux-mtd, linux-kernel, llvm, Tom Rix

clang with W=1 reports
drivers/mtd/lpddr/lpddr_cmds.c:409:31: error: variable
  'words' set but not used [-Werror,-Wunused-but-set-variable]
        int ret, wbufsize, word_gap, words;
                                     ^
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/mtd/lpddr/lpddr_cmds.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/lpddr/lpddr_cmds.c b/drivers/mtd/lpddr/lpddr_cmds.c
index ee063baed136..3c3939bc2dad 100644
--- a/drivers/mtd/lpddr/lpddr_cmds.c
+++ b/drivers/mtd/lpddr/lpddr_cmds.c
@@ -406,7 +406,7 @@ static int do_write_buffer(struct map_info *map, struct flchip *chip,
 {
 	struct lpddr_private *lpddr = map->fldrv_priv;
 	map_word datum;
-	int ret, wbufsize, word_gap, words;
+	int ret, wbufsize, word_gap;
 	const struct kvec *vec;
 	unsigned long vec_seek;
 	unsigned long prog_buf_ofs;
@@ -421,10 +421,7 @@ static int do_write_buffer(struct map_info *map, struct flchip *chip,
 	}
 	/* Figure out the number of words to write */
 	word_gap = (-adr & (map_bankwidth(map)-1));
-	words = (len - word_gap + map_bankwidth(map) - 1) / map_bankwidth(map);
-	if (!word_gap) {
-		words--;
-	} else {
+	if (word_gap) {
 		word_gap = map_bankwidth(map) - word_gap;
 		adr -= word_gap;
 		datum = map_word_ff(map);
-- 
2.27.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] mtd: lpddr_cmds: remove unused words variable
@ 2023-03-28  0:06 ` Tom Rix
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rix @ 2023-03-28  0:06 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr, nathan, ndesaulniers
  Cc: linux-mtd, linux-kernel, llvm, Tom Rix

clang with W=1 reports
drivers/mtd/lpddr/lpddr_cmds.c:409:31: error: variable
  'words' set but not used [-Werror,-Wunused-but-set-variable]
        int ret, wbufsize, word_gap, words;
                                     ^
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/mtd/lpddr/lpddr_cmds.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/lpddr/lpddr_cmds.c b/drivers/mtd/lpddr/lpddr_cmds.c
index ee063baed136..3c3939bc2dad 100644
--- a/drivers/mtd/lpddr/lpddr_cmds.c
+++ b/drivers/mtd/lpddr/lpddr_cmds.c
@@ -406,7 +406,7 @@ static int do_write_buffer(struct map_info *map, struct flchip *chip,
 {
 	struct lpddr_private *lpddr = map->fldrv_priv;
 	map_word datum;
-	int ret, wbufsize, word_gap, words;
+	int ret, wbufsize, word_gap;
 	const struct kvec *vec;
 	unsigned long vec_seek;
 	unsigned long prog_buf_ofs;
@@ -421,10 +421,7 @@ static int do_write_buffer(struct map_info *map, struct flchip *chip,
 	}
 	/* Figure out the number of words to write */
 	word_gap = (-adr & (map_bankwidth(map)-1));
-	words = (len - word_gap + map_bankwidth(map) - 1) / map_bankwidth(map);
-	if (!word_gap) {
-		words--;
-	} else {
+	if (word_gap) {
 		word_gap = map_bankwidth(map) - word_gap;
 		adr -= word_gap;
 		datum = map_word_ff(map);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: lpddr_cmds: remove unused words variable
  2023-03-28  0:06 ` Tom Rix
@ 2023-03-28 14:31   ` Miquel Raynal
  -1 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2023-03-28 14:31 UTC (permalink / raw)
  To: Tom Rix, miquel.raynal, richard, vigneshr, nathan, ndesaulniers
  Cc: linux-mtd, linux-kernel, llvm

On Tue, 2023-03-28 at 00:06:20 UTC, Tom Rix wrote:
> clang with W=1 reports
> drivers/mtd/lpddr/lpddr_cmds.c:409:31: error: variable
>   'words' set but not used [-Werror,-Wunused-but-set-variable]
>         int ret, wbufsize, word_gap, words;
>                                      ^
> This variable is not used so remove it.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: lpddr_cmds: remove unused words variable
@ 2023-03-28 14:31   ` Miquel Raynal
  0 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2023-03-28 14:31 UTC (permalink / raw)
  To: Tom Rix, miquel.raynal, richard, vigneshr, nathan, ndesaulniers
  Cc: linux-mtd, linux-kernel, llvm

On Tue, 2023-03-28 at 00:06:20 UTC, Tom Rix wrote:
> clang with W=1 reports
> drivers/mtd/lpddr/lpddr_cmds.c:409:31: error: variable
>   'words' set but not used [-Werror,-Wunused-but-set-variable]
>         int ret, wbufsize, word_gap, words;
>                                      ^
> This variable is not used so remove it.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-28 14:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-28  0:06 [PATCH] mtd: lpddr_cmds: remove unused words variable Tom Rix
2023-03-28  0:06 ` Tom Rix
2023-03-28 14:31 ` Miquel Raynal
2023-03-28 14:31   ` Miquel Raynal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.