mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 14:19:16 +00:00
driver core: add error handling for devtmpfs_create_node()
In some cases, devtmpfs_create_node() can return error value. So, make use of it. Signed-off-by: Longlong Xia <xialonglong1@huawei.com> Link: https://lore.kernel.org/r/20230210095444.4067307-2-xialonglong1@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ccfc901f01
commit
31b4b6730f
1 changed files with 5 additions and 1 deletions
|
@ -3602,7 +3602,9 @@ int device_add(struct device *dev)
|
|||
if (error)
|
||||
goto SysEntryError;
|
||||
|
||||
devtmpfs_create_node(dev);
|
||||
error = devtmpfs_create_node(dev);
|
||||
if (error)
|
||||
goto DevtmpfsError;
|
||||
}
|
||||
|
||||
/* Notify clients of device addition. This call must come
|
||||
|
@ -3658,6 +3660,8 @@ int device_add(struct device *dev)
|
|||
done:
|
||||
put_device(dev);
|
||||
return error;
|
||||
DevtmpfsError:
|
||||
device_remove_sys_dev_entry(dev);
|
||||
SysEntryError:
|
||||
if (MAJOR(dev->devt))
|
||||
device_remove_file(dev, &dev_attr_dev);
|
||||
|
|
Loading…
Reference in a new issue