mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-17 02:15:57 +00:00
devcoredump: avoid -Wempty-body warnings
Cleaning out the last -Wempty-body warnings found some interesting cases with empty macros, along with harmless warnings like this one: drivers/base/devcoredump.c: In function 'dev_coredumpm': drivers/base/devcoredump.c:297:56: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body] 297 | /* nothing - symlink will be missing */; | ^ drivers/base/devcoredump.c:301:56: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body] 301 | /* nothing - symlink will be missing */; | ^ Randy tried addressing this one before, and there were multiple other ideas in that thread. Add a runtime warning and code comment here. Link: https://lore.kernel.org/lkml/20200418184111.13401-8-rdunlap@infradead.org/ Cc: Randy Dunlap <rdunlap@infradead.org> Cc: Matthew Wilcox <willy@infradead.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20210322114258.3420937-1-arnd@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7f2fac70b7
commit
53f95c5534
@ -292,13 +292,16 @@ void dev_coredumpm(struct device *dev, struct module *owner,
|
|||||||
if (device_add(&devcd->devcd_dev))
|
if (device_add(&devcd->devcd_dev))
|
||||||
goto put_device;
|
goto put_device;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These should normally not fail, but there is no problem
|
||||||
|
* continuing without the links, so just warn instead of
|
||||||
|
* failing.
|
||||||
|
*/
|
||||||
if (sysfs_create_link(&devcd->devcd_dev.kobj, &dev->kobj,
|
if (sysfs_create_link(&devcd->devcd_dev.kobj, &dev->kobj,
|
||||||
"failing_device"))
|
"failing_device") ||
|
||||||
/* nothing - symlink will be missing */;
|
sysfs_create_link(&dev->kobj, &devcd->devcd_dev.kobj,
|
||||||
|
"devcoredump"))
|
||||||
if (sysfs_create_link(&dev->kobj, &devcd->devcd_dev.kobj,
|
dev_warn(dev, "devcoredump create_link failed\n");
|
||||||
"devcoredump"))
|
|
||||||
/* nothing - symlink will be missing */;
|
|
||||||
|
|
||||||
INIT_DELAYED_WORK(&devcd->del_wk, devcd_del);
|
INIT_DELAYED_WORK(&devcd->del_wk, devcd_del);
|
||||||
schedule_delayed_work(&devcd->del_wk, DEVCD_TIMEOUT);
|
schedule_delayed_work(&devcd->del_wk, DEVCD_TIMEOUT);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user