public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Cc: Oleg Drokin <oleg.drokin@intel.com>,
	Andreas Dilger <andreas.dilger@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Lai Siyao <laisiyao@whamcloud.com>, Peng Tao <bergwolf@gmail.com>,
	Julia Lawall <Julia.Lawall@lip6.fr>,
	Greg Donald <gdonald@gmail.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	"John L. Hammond" <john.hammond@intel.com>,
	Brian Behlendorf <behlendorf1@llnl.gov>,
	HPDD-discuss@ml01.01.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: lustre: lustre: llite: llite_lib.c:  Removes unnecessary NULL check
Date: Sun, 21 Dec 2014 15:30:17 -0800	[thread overview]
Message-ID: <1419204617.4200.13.camel@perches.com> (raw)
In-Reply-To: <1419199680-13390-1-git-send-email-rickard_strandqvist@spectrumdigital.se>

On Sun, 2014-12-21 at 23:08 +0100, Rickard Strandqvist wrote:
> Removes same unnecessary NULL check.

Depending on settings, these checks are necessary:

drivers/staging/lustre/lustre/include/obd_support.h:#define POISON(ptr, c, s) memset(ptr, c, s)
[]
drivers/staging/lustre/lustre/include/obd_support.h:#define OBD_FREE_PRE(ptr, size, name)                                  \
drivers/staging/lustre/lustre/include/obd_support.h-    LASSERT(ptr);                                              \
drivers/staging/lustre/lustre/include/obd_support.h-    obd_memory_sub(size);                                      \
drivers/staging/lustre/lustre/include/obd_support.h-    CDEBUG(D_MALLOC, name " '" #ptr "': %d at %p.\n",              \
drivers/staging/lustre/lustre/include/obd_support.h-           (int)(size), ptr);                                      \
drivers/staging/lustre/lustre/include/obd_support.h-    POISON(ptr, 0x5a, size)
[]
drivers/staging/lustre/lustre/include/obd_support.h:#define OBD_FREE(ptr, size)                                            \
drivers/staging/lustre/lustre/include/obd_support.h-do {                                                                          \
drivers/staging/lustre/lustre/include/obd_support.h-    OBD_FREE_PRE(ptr, size, "kfreed");                                  \
drivers/staging/lustre/lustre/include/obd_support.h-    kfree(ptr);                                                     \
drivers/staging/lustre/lustre/include/obd_support.h-    POISON_PTR(ptr);                                                      \
drivers/staging/lustre/lustre/include/obd_support.h-} while (0)

> diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
[]
> @@ -591,10 +591,8 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
>  		get_uuid2fsid(uuid->uuid, strlen(uuid->uuid), &sbi->ll_fsid);
>  	}
>  
> -	if (data != NULL)
> -		OBD_FREE_PTR(data);
> -	if (osfs != NULL)
> -		OBD_FREE_PTR(osfs);
> +	OBD_FREE_PTR(data);
> +	OBD_FREE_PTR(osfs);



      reply	other threads:[~2014-12-21 23:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-21 22:08 [PATCH] staging: lustre: lustre: llite: llite_lib.c: Removes unnecessary NULL check Rickard Strandqvist
2014-12-21 23:30 ` Joe Perches [this message]

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=1419204617.4200.13.camel@perches.com \
    --to=joe@perches.com \
    --cc=HPDD-discuss@ml01.01.org \
    --cc=Julia.Lawall@lip6.fr \
    --cc=andreas.dilger@intel.com \
    --cc=behlendorf1@llnl.gov \
    --cc=bergwolf@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gdonald@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.hammond@intel.com \
    --cc=laisiyao@whamcloud.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg.drokin@intel.com \
    --cc=rickard_strandqvist@spectrumdigital.se \
    --cc=viro@zeniv.linux.org.uk \
    /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