Skip to contentSkip to conversation

gpio: fix clang -Wpointer-bool-conversion warning

PATCH Applied Ossama Othman 2 participants 2 messages Jun 19, 2019 – Jun 20, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: fix clang -Wpointer-bool-conversion warning

Remove a check that incorrectly attempted to determine if the "name" field of a struct gpioline_info object was NULL. It relied on a pointer-to-bool conversion that didn't work as expected since the "name" field is an array, not a pointer. The address of an array always evaluates to true when converted to a boolean. In this case, there is no need for a NULL pointer check.

---
 ell/gpio.c | 3 ---
 1 file changed, 3 deletions(-)
ell/gpio.c +0 -3
index bd0e9c9..c470ba9 100644
@@ -189,9 +189,6 @@ LIB_EXPORT bool l_gpio_chip_find_line_offset(struct l_gpio_chip *chip,
 		if (ioctl(chip->fd, GPIO_GET_LINEINFO_IOCTL, &info) < 0)
 			return false;
 
-		if (!info.name)
-			continue;
-
 		if (strcmp(info.name, line_label) != 0)
 			continue;
 
Signature · 1 line
2.20.1
#1 lore raw

Hi Ossama,

Quoted 10 lines · Ossama Othman

Remove a check that incorrectly attempted to determine if the "name" field of a struct gpioline_info object was NULL. It relied on a pointer-to-bool conversion that didn't work as expected since the "name" field is an array, not a pointer. The address of an array always evaluates to true when converted to a boolean. In this case, there is no need for a NULL pointer check.

---
  ell/gpio.c | 3 ---
  1 file changed, 3 deletions(-)

Applied, thanks.

Regards,
-Denis