pwm: Fix possible ZERO_SIZE_PTR pointer dereferencing error.
authorXiubo Li <Li.Xiubo@freescale.com>
Mon, 18 Aug 2014 09:08:44 +0000 (17:08 +0800)
committerThierry Reding <thierry.reding@gmail.com>
Mon, 25 Aug 2014 12:38:12 +0000 (14:38 +0200)
Since we cannot make sure the 'chip->npwm' will always be none zero here,
and then if either equal to zero, the kzalloc() will return ZERO_SIZE_PTR,
which equals to ((void *)16).

So this patch fix this with just doing the zero check before calling kzalloc().

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/core.c

Simple merge