Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

driver core: Fix device_link_flag_is_sync_state_only()

device_link_flag_is_sync_state_only() correctly returns true on the flags
of an existing device link that only implements sync_state() functionality.
However, it incorrectly and confusingly returns false if it's called with
DL_FLAG_SYNC_STATE_ONLY.

This bug doesn't manifest in any of the existing calls to this function,
but fix this confusing behavior to avoid future bugs.

Fixes: 67cad5c67019 ("driver core: fw_devlink: Add DL_FLAG_CYCLE support to device links")
Signed-off-by: Saravana Kannan <saravanak@google.com>
Tested-by: Xu Yang <xu.yang_2@nxp.com>
Link: https://lore.kernel.org/r/20240202095636.868578-2-saravanak@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Saravana Kannan and committed by
Greg Kroah-Hartman
7fddac12 98323e9d

+4 -2
+4 -2
drivers/base/core.c
··· 284 284 return false; 285 285 } 286 286 287 + #define DL_MARKER_FLAGS (DL_FLAG_INFERRED | \ 288 + DL_FLAG_CYCLE | \ 289 + DL_FLAG_MANAGED) 287 290 static inline bool device_link_flag_is_sync_state_only(u32 flags) 288 291 { 289 - return (flags & ~(DL_FLAG_INFERRED | DL_FLAG_CYCLE)) == 290 - (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED); 292 + return (flags & ~DL_MARKER_FLAGS) == DL_FLAG_SYNC_STATE_ONLY; 291 293 } 292 294 293 295 /**