Skip to contentSkip to conversation

spi: bcm63xx-hsspi: Fix compiler warning

PATCH In review William Zhang 2 participants 2 messages Aug 12, 2023 – Dec 6, 2023 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: bcm63xx-hsspi: Fix compiler warning

When build for arm64 target, comipler reports the following warning:
drivers/spi/bcm63xx_hsspi.c: In function ‘bcm63xx_hsspi_xfer_dummy_cs’:
include/linux/kernel.h:184:17: warning: comparison of distinct pointer types lacks a cast
184 | (void) (&_min1 == &_min2); \
| ^~
drivers/spi/bcm63xx_hsspi.c:298:22: note: in expansion of macro ‘min’
298 | size_t curr_step = min(step_size, data_bytes);

This change fix this warning by casting the data_bytes to size_t.

Fixes 0e144ec38cbb ("spi: bcm63xx-hsspi: Add prepend mode support")

---

 drivers/spi/bcm63xx_hsspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/bcm63xx_hsspi.c +1 -1
index a24bb430cbb4..19d9a5ae23cd 100644
@@ -295,7 +295,7 @@ static int bcm63xx_hsspi_xfer_dummy_cs(struct udevice *dev, unsigned int data_by
 
 	/* transfer loop */
 	while (data_bytes > 0) {
-		size_t curr_step = min(step_size, data_bytes);
+		size_t curr_step = min(step_size, (size_t)data_bytes);
 		int ret;
 
 		/* copy tx data */
Signature · 1 line
2.37.3
#1 lore raw
Quoted 10 lines · William Zhang

When build for arm64 target, comipler reports the following warning:
drivers/spi/bcm63xx_hsspi.c: In function ‘bcm63xx_hsspi_xfer_dummy_cs’:
include/linux/kernel.h:184:17: warning: comparison of distinct pointer types lacks a cast
184 | (void) (&_min1 == &_min2); \
| ^~
drivers/spi/bcm63xx_hsspi.c:298:22: note: in expansion of macro ‘min’
298 | size_t curr_step = min(step_size, data_bytes);

Quoted 5 lines

This change fix this warning by casting the data_bytes to size_t.

Fixes 0e144ec38cbb ("spi: bcm63xx-hsspi: Add prepend mode support")

---

Applied u-boot-spi/master