From: Insu Yun Date: Tue, 16 Feb 2016 02:19:57 +0000 (-0500) Subject: gpio-mcp23s08: correctly handling failed allocation X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=aaf2b3afb93102411412f9dad8d84b13fc7f7edb;p=deliverable%2Flinux.git gpio-mcp23s08: correctly handling failed allocation Since devm_kzalloc can be failed in memory pressure, it needs to check and return -ENOMEM Signed-off-by: Insu Yun Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c index c767879e4dd9..f8d4abcff573 100644 --- a/drivers/gpio/gpio-mcp23s08.c +++ b/drivers/gpio/gpio-mcp23s08.c @@ -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; } }