regulator: axp20x: add NULL check on devm_kzalloc() return value
authorGustavo A. R. Silva <garsilva@embeddedor.com>
Thu, 6 Jul 2017 21:49:18 +0000 (16:49 -0500)
committerMark Brown <broonie@kernel.org>
Fri, 7 Jul 2017 12:48:33 +0000 (13:48 +0100)
commitda2629684822091bf15c6c14d8e33b75dfce8637
tree0304b11bc79c62dde3ad513be278ce7aaabd27ca
parent8d67f64f7739464c352d4b167ed1748f3b2c1f44
regulator: axp20x: add NULL check on devm_kzalloc() return value

Check return value from call to devm_kzalloc()
in order to prevent a NULL pointer dereference.

This issue was detected using Coccinelle and the following semantic patch:

@@
expression x;
identifier fld;
@@

* x = devm_kzalloc(...);
  ... when != x == NULL
  x->fld

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/axp20x-regulator.c