Skip to contentSkip to conversation

atm: firestream: avoid conversion error during build

PATCH In review Helge Deller 2 participants 2 messages Nov 16, 2021

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

PATCH 1/1 atm: firestream: avoid conversion error during build

Although the firestream driver isn't relevant for the parisc architecture, but it generates this compile error when CONFIG_TEST is defined:

drivers/atm/firestream.c: In function ‘top_off_fp’:
arch/parisc/include/asm/io.h:8:25: error: conversion from ‘long unsigned int’ to ‘u32’ {aka ‘unsigned int’} changes value

     from ‘18446744072635809792’ to ‘3221225472’ [-Werror=overflow]
 drivers/atm/firestream.c:1494:29: note: in expansion of macro ‘virt_to_bus’
            ne->next  = virt_to_bus (NULL);

ne->next is of type u32, so this patch avoids the error by casting the return value of virt_to_bus() to u32.

---

drivers/atm/firestream.c +1 -1
index 3bc3c314a467..8148a4ea194c 100644
@@ -1491,7 +1491,7 @@ static void top_off_fp (struct fs_dev *dev, struct freepool *fp,
 			    skb, ne, skb->data, skb->head);
 		n++;
 		ne->flags = FP_FLAGS_EPI | fp->bufsize;
-		ne->next  = virt_to_bus (NULL);
+		ne->next  = (u32)virt_to_bus (NULL);
 		ne->bsa   = virt_to_bus (skb->data);
 		ne->aal_bufsize = fp->bufsize;
 		ne->skb = skb;
#1 lore raw
Quoted 22 lines · Helge Deller

Although the firestream driver isn't relevant for the parisc architecture, but it generates this compile error when CONFIG_TEST is defined:

drivers/atm/firestream.c: In function ‘top_off_fp’:
arch/parisc/include/asm/io.h:8:25: error: conversion from ‘long unsigned int’ to ‘u32’ {aka ‘unsigned int’} changes value

     from ‘18446744072635809792’ to ‘3221225472’ [-Werror=overflow]
 drivers/atm/firestream.c:1494:29: note: in expansion of macro ‘virt_to_bus’
            ne->next  = virt_to_bus (NULL);

ne->next is of type u32, so this patch avoids the error by casting the return value of virt_to_bus() to u32.

---

drivers/atm/firestream.c +0 -0
index 3bc3c314a467..8148a4ea194c 100644

drivers/atm/firestream.c static void top_off_fp (struct fs_dev *dev, struct freepool *fp, · line 1497

Quoted 8 lines
drivers/atm/firestream.c +1 -1
@@ -1491,7 +1491,7 @@ static void top_off_fp (struct fs_dev *dev, struct freepool *fp,
 			    skb, ne, skb->data, skb->head);
 		n++;
 		ne->flags = FP_FLAGS_EPI | fp->bufsize;
-		ne->next  = virt_to_bus (NULL);
+		ne->next  = (u32)virt_to_bus (NULL);
 		ne->bsa   = virt_to_bus (skb->data);
 		ne->aal_bufsize = fp->bufsize;
 		ne->skb = skb;

Does virt_to_bus() make any sense on NULL? Maybe just assign NULL?

Andrew