From: Marek Vasut Date: Sun, 15 Nov 2020 20:22:53 +0000 (+0100) Subject: dm: core: Fix incorrect flag check X-Git-Url: http://git.dujemihanovic.xyz/login.html?a=commitdiff_plain;h=e7e7e1093b5243b058c420eaebf9373cf2d3f270;p=u-boot.git 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. Signed-off-by: Marek Vasut Cc: Simon Glass Reviewed-by: Simon Glass --- diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c index efdb0f2905..0924a575f5 100644 --- a/drivers/core/device-remove.c +++ b/drivers/core/device-remove.c @@ -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;