Skip to content

Commit

Permalink
driver core: Read atomic counter once in driver_probe_done()
Browse files Browse the repository at this point in the history
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 <andriy.shevchenko@linux.intel.com>
Tested-by: Ferry Toth <fntoth@gmail.com>
Link: https://lore.kernel.org/r/20200324122023.9649-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Andy Shevchenko authored and Greg Kroah-Hartman committed Mar 24, 2020
1 parent a65cab7 commit 927f828
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/base/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,9 +644,10 @@ static int really_probe_debug(struct device *dev, struct device_driver *drv)
*/
int driver_probe_done(void)
{
pr_debug("%s: probe_count = %d\n", __func__,
atomic_read(&probe_count));
if (atomic_read(&probe_count))
int local_probe_count = atomic_read(&probe_count);

pr_debug("%s: probe_count = %d\n", __func__, local_probe_count);
if (local_probe_count)
return -EBUSY;
return 0;
}
Expand Down

0 comments on commit 927f828

Please sign in to comment.