Skip to contentSkip to conversation

gpio-mcp23s08: correctly handling failed allocation

PATCH In review Insu Yun 2 participants 2 messages Feb 16, 2016 GPIO

lore
Share & tools
lore

Insu Yun

author
#0 lore raw

PATCH 1/1 gpio-mcp23s08: correctly handling failed allocation

Since devm_kzalloc can be failed in memory pressure, it needs to check and return -ENOMEM

---
 drivers/gpio/gpio-mcp23s08.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpio/gpio-mcp23s08.c +2 -0
index c767879..ed51dcf 100644
@@ -803,6 +803,8 @@ static int mcp230xx_probe(struct i2c_client *client,
 			pdata = devm_kzalloc(&client->dev,
 					sizeof(struct mcp23s08_platform_data),
 					GFP_KERNEL);
+			if (!pdata)
+				return -ENOMEM;
 			pdata->base = -1;
 		}
 	}
Signature · 1 line
1.9.1