Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: linux-kernel@vger.kernel.org, drbd-user@lists.linbit.com,
	Lars Ellenberg <drbd-dev@lists.linbit.com>
Subject: Re: [Drbd-dev] [Patch] drbd: check MODULE for THIS_MODULE
Date: Mon, 9 Apr 2012 16:14:27 -0700	[thread overview]
Message-ID: <20120409161427.1decc2c1.akpm@linux-foundation.org> (raw)
In-Reply-To: <1333433616-8315-1-git-send-email-xiyou.wangcong@gmail.com>

On Tue,  3 Apr 2012 14:13:36 +0800
Cong Wang <xiyou.wangcong@gmail.com> wrote:

> THIS_MODULE is NULL only when drbd is compiled as built-in,
> so the #ifdef CONFIG_MODULES should be #ifdef MODULE instead.
> 
> This fixes the warning:
> 
> 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]
> 
> Cc: Lars Ellenberg <drbd-dev@lists.linbit.com>
> Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
> 
> ---
> diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
> index 211fc44..96c432f 100644
> --- a/drivers/block/drbd/drbd_main.c
> +++ b/drivers/block/drbd/drbd_main.c
> @@ -4183,12 +4183,11 @@ const char *drbd_buildtag(void)
>  	static char buildtag[38] = "\0uilt-in";
>  
>  	if (buildtag[0] == 0) {
> -#ifdef CONFIG_MODULES
> -		if (THIS_MODULE != NULL)
> -			sprintf(buildtag, "srcversion: %-24s", THIS_MODULE->srcversion);
> -		else
> +#ifdef MODULE
> +		sprintf(buildtag, "srcversion: %-24s", THIS_MODULE->srcversion);
> +#else
> +		buildtag[0] = 'b';
>  #endif
> -			buildtag[0] = 'b';
>  	}
>  
>  	return buildtag;

If the MODULE_SRCVERSION_ALL help in init/Kconfig is to be believed,
this should depend on CONFIG_MODULE_SRCVERSION_ALL?

But drbd is the only driver in all of Linux which plays with
srcversion.  Can we just delete this code?


  reply	other threads:[~2012-04-09 23:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-03  6:13 [Drbd-dev] [Patch] drbd: check MODULE for THIS_MODULE Cong Wang
2012-04-09 23:14 ` Andrew Morton [this message]
2012-04-12  8:33   ` Lars Ellenberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120409161427.1decc2c1.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=drbd-dev@lists.linbit.com \
    --cc=drbd-user@lists.linbit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox