mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
mm: memory_hotplug: use put_device() if device_register fail
if device_register() returned an error. Always use put_device() to give up the initialized reference and release allocated memory. Signed-off-by: Arvind Yadav <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
13509860ef
commit
085aa2de56
1 changed files with 7 additions and 1 deletions
|
|
@ -649,13 +649,19 @@ static const struct attribute_group *memory_memblk_attr_groups[] = {
|
|||
static
|
||||
int register_memory(struct memory_block *memory)
|
||||
{
|
||||
int ret;
|
||||
|
||||
memory->dev.bus = &memory_subsys;
|
||||
memory->dev.id = memory->start_section_nr / sections_per_block;
|
||||
memory->dev.release = memory_block_release;
|
||||
memory->dev.groups = memory_memblk_attr_groups;
|
||||
memory->dev.offline = memory->state == MEM_OFFLINE;
|
||||
|
||||
return device_register(&memory->dev);
|
||||
ret = device_register(&memory->dev);
|
||||
if (ret)
|
||||
put_device(&memory->dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int init_memory_block(struct memory_block **memory,
|
||||
|
|
|
|||
Loading…
Reference in a new issue