dax: avoid -Wempty-body warnings
PATCH 1/1 dax: avoid -Wempty-body warnings
From: Arnd Bergmann <[email protected]>
gcc warns about an empty body in an else statement:
drivers/dax/bus.c: In function 'do_id_store':drivers/dax/bus.c:94:48: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
94 | /* nothing to remove */;
| ^drivers/dax/bus.c:99:43: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
99 | /* dax_id already added */;
| ^
In both of these cases, the 'else' exists only to have a place to add a comment, but that comment doesn't really explain that much either, so the easiest way to shut up that warning is to just remove the else.
--- drivers/dax/bus.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/dax/bus.c +2 -4
@@ -90,13 +90,11 @@ static ssize_t do_id_store(struct device_driver *drv, const char *buf,list_add (&dax_id->list, &dax_drv->ids); }else rc = -ENOMEM ; - }else -/* nothing to remove */ ; + } }else if (action ==ID_REMOVE ) {list_del (&dax_id->list);kfree (dax_id); - }else -/* dax_id already added */ ; + }mutex_unlock (&dax_bus_lock);if (rc <0 )
Signature · 4 lines
2.29.2 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Quoted 13 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
gcc warns about an empty body in an else statement:
drivers/dax/bus.c: In function 'do_id_store':drivers/dax/bus.c:94:48: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
94 | /* nothing to remove */;
| ^drivers/dax/bus.c:99:43: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
99 | /*dax_idalready added */;
| ^
Quoted 4 lines
In both of these cases, the 'else' exists only to have a place to add a comment, but that comment doesn't really explain that much either, so the easiest way to shut up that warning is to just remove the else.
Ok, applied, thanks.
_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]