Skip to content

Commit 7fddac1

Browse files
Saravana Kannangregkh
authored andcommitted
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: 67cad5c ("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>
1 parent 98323e9 commit 7fddac1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/base/core.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,12 @@ static bool device_is_ancestor(struct device *dev, struct device *target)
284284
return false;
285285
}
286286

287+
#define DL_MARKER_FLAGS (DL_FLAG_INFERRED | \
288+
DL_FLAG_CYCLE | \
289+
DL_FLAG_MANAGED)
287290
static inline bool device_link_flag_is_sync_state_only(u32 flags)
288291
{
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;
291293
}
292294

293295
/**

0 commit comments

Comments
 (0)