summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2020-03-24 15:20:22 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-03-24 15:33:25 +0300
commit927f82875c272e8c1159cb2c00bda473402c7c28 (patch)
tree4fa8afaef32dfaf40c2ffd70baf1f201d8df0c6a /drivers/base
parenta65cab7d7f05c2061a3e2490257d3086ff3202c6 (diff)
downloadlinux-927f82875c272e8c1159cb2c00bda473402c7c28.tar.xz
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 <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>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/dd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 76888a7459d8..3f5b8bdd94f0 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -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;
}