Re: [PATCH 2/3] staging: wilc1000: coreconfigurator.c: add kmalloc error check

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

 



On Thu, Jul 23, 2015 at 08:19:18PM +0900, Chaehyun Lim wrote:
> Add error check if memory allocation is failed.
> 
> Signed-off-by: Chaehyun Lim <chaehyun.lim@xxxxxxxxx>
> ---
>  drivers/staging/wilc1000/coreconfigurator.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
> index 7e2b2ab41..b51c15f 100644
> --- a/drivers/staging/wilc1000/coreconfigurator.c
> +++ b/drivers/staging/wilc1000/coreconfigurator.c
> @@ -812,6 +812,9 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
>  		u32 u32Tsf_Hi;
>  
>  		pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_ATOMIC);
> +		if (pstrNetworkInfo == NULL)
> +			return -ENOMEM;

Run your patches through checkpatch.pl --strict.  These days we prefer:

		if (!pstrNetworkInfo)
			return -ENOMEM;

These patches are nice otherwise.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-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