Commit aaf2b3af authored by Insu Yun's avatar Insu Yun Committed by Linus Walleij

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: default avatarInsu Yun <wuninsu@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 818cc6a5
...@@ -803,6 +803,8 @@ static int mcp230xx_probe(struct i2c_client *client, ...@@ -803,6 +803,8 @@ static int mcp230xx_probe(struct i2c_client *client,
pdata = devm_kzalloc(&client->dev, pdata = devm_kzalloc(&client->dev,
sizeof(struct mcp23s08_platform_data), sizeof(struct mcp23s08_platform_data),
GFP_KERNEL); GFP_KERNEL);
if (!pdata)
return -ENOMEM;
pdata->base = -1; pdata->base = -1;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment