[PATCH] block/drbd: simplify drbd_buildtag fixing a build warning

From: Uwe Kleine-KÃnig
Date: Mon Mar 19 2012 - 12:12:06 EST


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@xxxxxxxxxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/