* [PATCH] dax: avoid -Wempty-body warnings
@ 2021-03-22 11:44 Arnd Bergmann
2021-03-22 16:20 ` Dan Williams
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2021-03-22 11:44 UTC (permalink / raw)
To: Dan Williams, Vishal Verma, Dave Jiang
Cc: Arnd Bergmann, Andrew Morton, Joao Martins,
Uwe Kleine-König, Zhen Lei, linux-nvdimm, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
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.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/dax/bus.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index 452e85ae87a8..5aee26e1bbd6 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -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)
--
2.29.2
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] dax: avoid -Wempty-body warnings
2021-03-22 11:44 [PATCH] dax: avoid -Wempty-body warnings Arnd Bergmann
@ 2021-03-22 16:20 ` Dan Williams
0 siblings, 0 replies; 2+ messages in thread
From: Dan Williams @ 2021-03-22 16:20 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Arnd Bergmann, Andrew Morton, Joao Martins,
Uwe Kleine-König, Zhen Lei, linux-nvdimm,
Linux Kernel Mailing List
On Mon, Mar 22, 2021 at 4:45 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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.
Ok, applied, thanks.
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-22 16:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22 11:44 [PATCH] dax: avoid -Wempty-body warnings Arnd Bergmann
2021-03-22 16:20 ` Dan Williams
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).