Skip to contentSkip to conversation

dm: core: Fix incorrect flag check

PATCH New Marek Vasut 2 participants 3 messages Nov 15, 2020 – Nov 30, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm: core: Fix incorrect flag check

The test should be checking whether $flags are non-zero and $drv_flags contain specific flags, however these two sets of flags are separate, and the two tests should be logically ANDed, not bitwise ANDed.

---
 drivers/core/device-remove.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/core/device-remove.c +1 -1
index efdb0f2905..0924a575f5 100644
@@ -152,7 +152,7 @@ void device_free(struct udevice *dev)
 static bool flags_remove(uint flags, uint drv_flags)
 {
 	if ((flags & DM_REMOVE_NORMAL) ||
-	    (flags & (drv_flags & (DM_FLAG_ACTIVE_DMA | DM_FLAG_OS_PREPARE))))
+	    (flags && (drv_flags & (DM_FLAG_ACTIVE_DMA | DM_FLAG_OS_PREPARE))))
 		return true;
 
 	return false;
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/1 dm: core: Fix incorrect flag check

Quoted 10 lines · Marek Vasut

The test should be checking whether $flags are non-zero and $drv_flags contain specific flags, however these two sets of flags are separate, and the two tests should be logically ANDed, not bitwise ANDed.

---
 drivers/core/device-remove.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#2 lore raw

PATCH 1/1 dm: core: Fix incorrect flag check

Quoted 10 lines · Marek Vasut

The test should be checking whether $flags are non-zero and $drv_flags contain specific flags, however these two sets of flags are separate, and the two tests should be logically ANDed, not bitwise ANDed.

---
 drivers/core/device-remove.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-dm, thanks!