Re: [PATCH] drivers: iio: industrialio-core: add check when kzalloc fails

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

 



On Thu, 24 Jan 2019 19:58:00 +0530, Bharath Vedartham said:
> add code to handle the case when kzalloc fails to allocate memory to dev
>
> Signed-off-by: Bharath Vedartham <linux.bhar@xxxxxxxxx>

>  		dev_set_name(&dev->dev, "iio:device%d", dev->id);
>  		INIT_LIST_HEAD(&dev->buffer_list);
> +	} else {
> +		return NULL;
>  	}
>  
>  	return dev;

Not needed, as the 'if (dev)' statement fails, dev is already null.



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux