* [PATCH] gpio-mcp23s08: correctly handling failed allocation
@ 2016-02-16 2:19 Insu Yun
2016-02-16 15:36 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Insu Yun @ 2016-02-16 2:19 UTC (permalink / raw)
To: linus.walleij, gnurou, linux-gpio, linux-kernel
Cc: taesoo, yeongjin.jang, insu, changwoo, Insu Yun
Since devm_kzalloc can be failed in memory pressure,
it needs to check and return -ENOMEM
Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
drivers/gpio/gpio-mcp23s08.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
index c767879..ed51dcf 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;
}
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gpio-mcp23s08: correctly handling failed allocation
2016-02-16 2:19 [PATCH] gpio-mcp23s08: correctly handling failed allocation Insu Yun
@ 2016-02-16 15:36 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2016-02-16 15:36 UTC (permalink / raw)
To: Insu Yun
Cc: Alexandre Courbot, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org, taesoo, yeongjin.jang, insu,
changwoo
On Tue, Feb 16, 2016 at 3:19 AM, Insu Yun <wuninsu@gmail.com> wrote:
> Since devm_kzalloc can be failed in memory pressure,
> it needs to check and return -ENOMEM
>
> Signed-off-by: Insu Yun <wuninsu@gmail.com>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-16 15:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-16 2:19 [PATCH] gpio-mcp23s08: correctly handling failed allocation Insu Yun
2016-02-16 15:36 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).