mirror of https://gitee.com/openkylin/linux.git
device-dax: Fix error path in dax_driver_register
The static variable match_always_count is supposed to track if there is a driver registered that has .match_always set. If driver_register() fails, the previous increment must be undone. Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org> Link: https://lore.kernel.org/r/20210205222842.34896-4-uwe@kleine-koenig.org Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
8029968e2a
commit
e307bf11c5
|
@ -1420,7 +1420,15 @@ int __dax_driver_register(struct dax_device_driver *dax_drv,
|
|||
mutex_unlock(&dax_bus_lock);
|
||||
if (rc)
|
||||
return rc;
|
||||
return driver_register(drv);
|
||||
|
||||
rc = driver_register(drv);
|
||||
if (rc && dax_drv->match_always) {
|
||||
mutex_lock(&dax_bus_lock);
|
||||
match_always_count -= dax_drv->match_always;
|
||||
mutex_unlock(&dax_bus_lock);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__dax_driver_register);
|
||||
|
||||
|
|
Loading…
Reference in New Issue