summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-mcp23s08.c
diff options
context:
space:
mode:
authorInsu Yun <wuninsu@gmail.com>2016-02-15 21:19:57 -0500
committerLinus Walleij <linus.walleij@linaro.org>2016-02-16 16:36:22 +0100
commitaaf2b3afb93102411412f9dad8d84b13fc7f7edb (patch)
treefbaec6ff0177caf4092b61f3322ee63a2cf3017a /drivers/gpio/gpio-mcp23s08.c
parent818cc6a5f8c6030d05f7dcb21970bf5f7db5dcbd (diff)
downloadblackbird-op-linux-aaf2b3afb93102411412f9dad8d84b13fc7f7edb.tar.gz
blackbird-op-linux-aaf2b3afb93102411412f9dad8d84b13fc7f7edb.zip
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 <wuninsu@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-mcp23s08.c')
-rw-r--r--drivers/gpio/gpio-mcp23s08.c2
1 files changed, 2 insertions, 0 deletions
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;
}
}
OpenPOWER on IntegriCloud