[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1455589197-6576-1-git-send-email-wuninsu@gmail.com>
Date: Mon, 15 Feb 2016 21:19:57 -0500
From: Insu Yun <wuninsu@...il.com>
To: linus.walleij@...aro.org, gnurou@...il.com,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: taesoo@...ech.edu, yeongjin.jang@...ech.edu, insu@...ech.edu,
changwoo@...ech.edu, Insu Yun <wuninsu@...il.com>
Subject: [PATCH] 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@...il.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
Powered by blists - more mailing lists