All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] staging: wlags49_h2: Replace kmalloc+memset by kzalloc and add error handling.
Date: Fri, 23 Mar 2012 09:51:58 +0000	[thread overview]
Message-ID: <20120323095158.GB3181@mwanda> (raw)

[-- Attachment #1: Type: text/plain, Size: 537 bytes --]

On Fri, Mar 23, 2012 at 03:11:45PM +0530, santosh nayak wrote:
> -        dev_wds = kmalloc( sizeof( struct net_device ), GFP_KERNEL );
> -        memset( dev_wds, 0, sizeof( struct net_device ));
> +	dev_wds = kzalloc(sizeof(struct net_device), GFP_KERNEL);
> +	if (unlikely(!dev_wds)) {
> +		printk(KERN_ERR "%s: failed to alloc memory\n", __func__);

Don't resend, but kmalloc() already prints out way more extensive
and useful error messages than this.  No need to print an error
message yourself normally.

regards,
dan carpenter



[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

             reply	other threads:[~2012-03-23  9:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-23  9:51 Dan Carpenter [this message]
2012-03-23  9:53 ` [PATCH] staging: wlags49_h2: Replace kmalloc+memset by kzalloc and add error handling santosh nayak
2012-03-23  9:58 ` santosh prasad nayak
2012-03-23 10:40 ` Dan Carpenter
2012-03-23 14:56 ` Greg KH
2012-03-23 15:41 ` Greg KH
2012-03-23 15:42 ` santosh prasad nayak
2012-03-27 20:53 ` Ezequiel García

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=20120323095158.GB3181@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    /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.