[PATCH 2/3] staging: wilc1000: coreconfigurator.c: add kmalloc error check
Dan Carpenter
dan.carpenter at oracle.com
Thu Jul 23 11:31:37 UTC 2015
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 at gmail.com>
> ---
> 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
More information about the devel
mailing list