projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ccfc901
)
driver core: add error handling for devtmpfs_create_node()
author
Longlong Xia
<xialonglong1@huawei.com>
Fri, 10 Feb 2023 09:54:42 +0000
(09:54 +0000)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Fri, 10 Feb 2023 10:26:36 +0000
(11:26 +0100)
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>
drivers/base/core.c
patch
|
blob
|
history
diff --git
a/drivers/base/core.c
b/drivers/base/core.c
index f9297c68214ae47db140860222f4bcf5e709d85f..4fc6f27641bfca3871d3a7c1815c78fdcf6d2ffc 100644
(file)
--- a/
drivers/base/core.c
+++ b/
drivers/base/core.c
@@
-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);