mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
libnvdimm: Hold reference on parent while scheduling async init
Unlike asynchronous initialization in the core we have not yet associated
the device with the parent, and as such the device doesn't hold a reference
to the parent.
In order to resolve that we should be holding a reference on the parent
until the asynchronous initialization has completed.
Cc: <[email protected]>
Fixes: 4d88a97aa9 ("libnvdimm: ...base ... infrastructure")
Signed-off-by: Alexander Duyck <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
This commit is contained in:
parent
3c5c98d135
commit
b6eae0f61d
1 changed files with 4 additions and 0 deletions
|
|
@ -488,6 +488,8 @@ static void nd_async_device_register(void *d, async_cookie_t cookie)
|
|||
put_device(dev);
|
||||
}
|
||||
put_device(dev);
|
||||
if (dev->parent)
|
||||
put_device(dev->parent);
|
||||
}
|
||||
|
||||
static void nd_async_device_unregister(void *d, async_cookie_t cookie)
|
||||
|
|
@ -507,6 +509,8 @@ void __nd_device_register(struct device *dev)
|
|||
if (!dev)
|
||||
return;
|
||||
dev->bus = &nvdimm_bus_type;
|
||||
if (dev->parent)
|
||||
get_device(dev->parent);
|
||||
get_device(dev);
|
||||
async_schedule_domain(nd_async_device_register, dev,
|
||||
&nd_async_domain);
|
||||
|
|
|
|||
Loading…
Reference in a new issue