Skip to content

Commit 4cdf1d2

Browse files
WhiteFox-Projectlag-linaro
authored andcommitted
mfd: ene-kb3930: Fix a potential NULL pointer dereference
The off_gpios could be NULL. Add missing check in the kb3930_probe(). This is similar to the issue fixed in commit b1ba8bc ("backlight: hx8357: Fix potential NULL pointer dereference"). This was detected by our static analysis tool. Cc: [email protected] Fixes: ede6b2d ("mfd: ene-kb3930: Add driver for ENE KB3930 Embedded Controller") Suggested-by: Lee Jones <[email protected]> Signed-off-by: Chenyuan Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent f4242e0 commit 4cdf1d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/mfd/ene-kb3930.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ static int kb3930_probe(struct i2c_client *client)
162162
devm_gpiod_get_array_optional(dev, "off", GPIOD_IN);
163163
if (IS_ERR(ddata->off_gpios))
164164
return PTR_ERR(ddata->off_gpios);
165-
if (ddata->off_gpios->ndescs < 2) {
165+
if (ddata->off_gpios && ddata->off_gpios->ndescs < 2) {
166166
dev_err(dev, "invalid off-gpios property\n");
167167
return -EINVAL;
168168
}

0 commit comments

Comments
 (0)