Skip to content

Commit 44e9604

Browse files
Saravana Kannangregkh
authored andcommitted
driver core: Fix handling of SYNC_STATE_ONLY + STATELESS device links
Commit 21c27f0 ("driver core: Fix SYNC_STATE_ONLY device link implementation") didn't completely fix STATELESS + SYNC_STATE_ONLY handling. What looks like an optimization in that commit is actually a bug that causes an if condition to always take the else path. This prevents reordering of devices in the dpm_list when a DL_FLAG_STATELESS device link is create on top of an existing DL_FLAG_SYNC_STATE_ONLY device link. Fixes: 21c27f0 ("driver core: Fix SYNC_STATE_ONLY device link implementation") Signed-off-by: Saravana Kannan <[email protected]> Cc: stable <[email protected]> Reviewed-by: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 21c27f0 commit 44e9604

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/base/core.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,14 @@ struct device_link *device_link_add(struct device *consumer,
360360

361361
if (flags & DL_FLAG_STATELESS) {
362362
kref_get(&link->kref);
363-
link->flags |= DL_FLAG_STATELESS;
364363
if (link->flags & DL_FLAG_SYNC_STATE_ONLY &&
365-
!(link->flags & DL_FLAG_STATELESS))
364+
!(link->flags & DL_FLAG_STATELESS)) {
365+
link->flags |= DL_FLAG_STATELESS;
366366
goto reorder;
367-
else
367+
} else {
368+
link->flags |= DL_FLAG_STATELESS;
368369
goto out;
370+
}
369371
}
370372

371373
/*

0 commit comments

Comments
 (0)