Skip to contentSkip to conversation

mtd: spi-nor: fix minmax.cocci warnings

PATCH In review Julia Lawall 3 participants 3 messages Mar 26, 2022 – Mar 29, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: spi-nor: fix minmax.cocci warnings

From: kernel test robot <[email protected]>

Use min to simplify the code.

Generated by: scripts/coccinelle/misc/minmax.cocci

Fixes 2747bc2106aa ("mtd: spi-nor: Add dual parallel and stacked mode support")
CC Amit Kumar Mahapatra <[email protected]>

---

tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15_LTS
head:   1870e0fa79a9d58c6748c34550f3ccea0b515933
commit: 2747bc2106aa429773d9a932c799aa6229595148 [840/1029] mtd: spi-nor: Add dual parallel and stacked mode support

:::::: branch date: 34 hours ago
:::::: commit date: 8 weeks ago

 drivers/mtd/spi-nor/core.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mtd/spi-nor/core.c +1 -4
@@ -2034,10 +2034,7 @@ static int spi_nor_read(struct mtd_info
 						(offset << nor->shift);
 			}
 		}
-		if (len < rem_bank_len)
-			read_len = len;
-		else
-			read_len = rem_bank_len;
+		read_len = min(len, rem_bank_len);
 
 		/* Wait till previous write/erase is done. */
 		ret = spi_nor_wait_till_ready(nor);
#1 lore raw

Hi.

Quoted 25 lines · Julia Lawall

From: kernel test robot <[email protected]>

Use min to simplify the code.

Generated by: scripts/coccinelle/misc/minmax.cocci

Fixes 2747bc2106aa ("mtd: spi-nor: Add dual parallel and stacked mode support")
CC Amit Kumar Mahapatra <[email protected]>

---

tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15_LTS
head:   1870e0fa79a9d58c6748c34550f3ccea0b515933
commit: 2747bc2106aa429773d9a932c799aa6229595148 [840/1029] mtd: spi-nor: Add dual parallel and stacked mode support

:::::: branch date: 34 hours ago
:::::: commit date: 8 weeks ago

 drivers/mtd/spi-nor/core.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

drivers/mtd/spi-nor/core.c static int spi_nor_read(struct mtd_info · line 2037

Quoted 8 lines
drivers/mtd/spi-nor/core.c +1 -4
@@ -2034,10 +2034,7 @@ static int spi_nor_read(struct mtd_info
 						(offset << nor->shift);
 			}
 		}
-		if (len < rem_bank_len)
-			read_len = len;
-		else
-			read_len = rem_bank_len;
+		read_len = min(len, rem_bank_len);

This chunk does not exist in mainline. Seems like xlnx local changes.

Regards
Vignesh

#2 lore raw
Quoted 25 lines · Vignesh Raghavendra

Hi.

Quoted 22 lines · Julia Lawall

From: kernel test robot <[email protected]>

Use min to simplify the code.

Generated by: scripts/coccinelle/misc/minmax.cocci

Fixes 2747bc2106aa ("mtd: spi-nor: Add dual parallel and stacked mode support")
CC Amit Kumar Mahapatra <[email protected]>

---

tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15_LTS
head:   1870e0fa79a9d58c6748c34550f3ccea0b515933
commit: 2747bc2106aa429773d9a932c799aa6229595148 [840/1029] mtd: spi-nor: Add dual parallel and stacked mode support

:::::: branch date: 34 hours ago
:::::: commit date: 8 weeks ago

 drivers/mtd/spi-nor/core.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
Quoted 13 lines

drivers/mtd/spi-nor/core.c static int spi_nor_read(struct mtd_info · line 2037

Quoted 11 lines
drivers/mtd/spi-nor/core.c +1 -4
@@ -2034,10 +2034,7 @@ static int spi_nor_read(struct mtd_info
 						(offset << nor->shift);
 			}
 		}
-		if (len < rem_bank_len)
-			read_len = len;
-		else
-			read_len = rem_bank_len;
+		read_len = min(len, rem_bank_len);

This chunk does not exist in mainline. Seems like xlnx local changes.

Yes. I was very confused for a bit until I realized. It would be nice if upstream maintainers and mailing lists were not Cced if the patch does not target the mainline branch.

Signature · 3 lines
Regards,
Pratyush Yadav
Texas Instruments Inc.