mfd: sm501: Fix potential NULL pointer dereference
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Tue, 22 Jan 2019 16:56:36 +0000 (10:56 -0600)
committerLee Jones <lee.jones@linaro.org>
Thu, 7 Feb 2019 10:42:47 +0000 (10:42 +0000)
commitae7b8eda27b33b1f688dfdebe4d46f690a8f9162
tree7125e9cb83d8f1955c8dddb6165dced548ed5c5a
parent09fdc98577120d4f47601c3127efde726a2300c6
mfd: sm501: Fix potential NULL pointer dereference

There is a potential NULL pointer dereference in case devm_kzalloc()
fails and returns NULL.

Fix this by adding a NULL check on *lookup*

This bug was detected with the help of Coccinelle.

Fixes: b2e63555592f ("i2c: gpio: Convert to use descriptors")
Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/sm501.c