gpio-mcp23s08: correctly handling failed allocation
authorInsu Yun <wuninsu@gmail.com>
Tue, 16 Feb 2016 02:19:57 +0000 (21:19 -0500)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 16 Feb 2016 15:36:22 +0000 (16:36 +0100)
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>
drivers/gpio/gpio-mcp23s08.c

index c767879e4dd9ad14902aebc419c83fc394bd953c..f8d4abcff5738aa4861a7e98e157f5528fca8920 100644 (file)
@@ -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;
                }
        }
This page took 0.025356 seconds and 5 git commands to generate.