[Drbd-dev] [PATCH] block/drbd: simplify drbd_buildtag fixing a build warning
Uwe Kleine-König
uwe at kleine-koenig.org
Mon Mar 19 17:11:27 CET 2012
This fixes:
drivers/block/drbd/drbd_main.c: In function ‘drbd_buildtag’:
drivers/block/drbd/drbd_main.c:4187:24: warning: the comparison will always evaluate as ‘true’ for the address of ‘__this_module’ will never be NULL [-Waddress]
Signed-off-by: Uwe Kleine-König <uwe at kleine-koenig.org>
---
drivers/block/drbd/drbd_main.c | 16 +++++++---------
1 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 211fc44..9cc7178 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -4177,21 +4177,19 @@ _drbd_insert_fault(struct drbd_conf *mdev, unsigned int type)
const char *drbd_buildtag(void)
{
+#if IS_MODULE(CONFIG_BLK_DEV_DRBD)
/* DRBD built from external sources has here a reference to the
git hash of the source code. */
- static char buildtag[38] = "\0uilt-in";
+ static char buildtag[38] = "\0";
- if (buildtag[0] == 0) {
-#ifdef CONFIG_MODULES
- if (THIS_MODULE != NULL)
- sprintf(buildtag, "srcversion: %-24s", THIS_MODULE->srcversion);
- else
-#endif
- buildtag[0] = 'b';
- }
+ if (buildtag[0] == '\0')
+ sprintf(buildtag, "srcversion: %-24s", THIS_MODULE->srcversion);
return buildtag;
+#else
+ return "built-in";
+#endif
}
module_init(drbd_init)
--
1.7.9.1
More information about the drbd-dev
mailing list