Skip to content

Commit 927f828

Browse files
andy-shevgregkh
authored andcommitted
driver core: Read atomic counter once in driver_probe_done()
Between printing the debug message and actual check atomic counter can be altered. For better debugging experience read atomic counter value only once. Signed-off-by: Andy Shevchenko <[email protected]> Tested-by: Ferry Toth <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a65cab7 commit 927f828

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/base/dd.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,10 @@ static int really_probe_debug(struct device *dev, struct device_driver *drv)
644644
*/
645645
int driver_probe_done(void)
646646
{
647-
pr_debug("%s: probe_count = %d\n", __func__,
648-
atomic_read(&probe_count));
649-
if (atomic_read(&probe_count))
647+
int local_probe_count = atomic_read(&probe_count);
648+
649+
pr_debug("%s: probe_count = %d\n", __func__, local_probe_count);
650+
if (local_probe_count)
650651
return -EBUSY;
651652
return 0;
652653
}

0 commit comments

Comments
 (0)