Re: [PATCH] staging: wlags49_h2: Replace kmalloc+memset by kzalloc and add error handling.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: Digital signature

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux