All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Himangi Saraogi <himangi774@gmail.com>,
	Jeff Dike <jdike@addtoit.com>,
	user-mode-linux-devel@lists.sourceforge.net,
	user-mode-linux-user@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Subject: Re: [PATCH] uml/net_kern: Eliminate NULL test after alloc_bootmem
Date: Thu, 24 Jul 2014 00:24:27 +0200	[thread overview]
Message-ID: <53D0361B.8060003@nod.at> (raw)
In-Reply-To: <20140719113405.GA23568@himangi-Dell>

Himangi,

Am 19.07.2014 13:34, schrieb Himangi Saraogi:
> alloc_bootmem and related functions never return NULL. Thus a NULL
> test or memset after calls to these functions is unnecessary.
> 
> The following Coccinelle semantic patch was used for making the change:
> 
> @@
> expression E;
> statement S;
> @@
> 
> E = \(alloc_bootmem\|alloc_bootmem_low\|alloc_bootmem_pages\|alloc_bootmem_low_pages\)(...)
> ... when != E
> - if (E == NULL) S
> 
> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
> Acked-by: Julia Lawall <julia.lawall@lip6.fr>

Thank you! All three patches are now queued for 3.17.

Thanks,
//richard

> ---
>  arch/um/drivers/net_kern.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
> index 7d26d9c..f70dd54 100644
> --- a/arch/um/drivers/net_kern.c
> +++ b/arch/um/drivers/net_kern.c
> @@ -659,10 +659,6 @@ static int __init eth_setup(char *str)
>  	}
>  
>  	new = alloc_bootmem(sizeof(*new));
> -	if (new == NULL) {
> -		printk(KERN_ERR "eth_init : alloc_bootmem failed\n");
> -		return 1;
> -	}
>  
>  	INIT_LIST_HEAD(&new->list);
>  	new->index = n;
> 

      reply	other threads:[~2014-07-23 22:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-19 11:34 [PATCH] uml/net_kern: Eliminate NULL test after alloc_bootmem Himangi Saraogi
2014-07-23 22:24 ` Richard Weinberger [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=53D0361B.8060003@nod.at \
    --to=richard@nod.at \
    --cc=himangi774@gmail.com \
    --cc=jdike@addtoit.com \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    --cc=user-mode-linux-user@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.