提交 2e9ff5f5 编写于 作者: L Lars-Peter Clausen 提交者: Anton Vorontsov

gpio-charger: Check result of kzalloc

Since kzalloc can return NULL we have to check its result.
Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: NVasiliy Kulikov <segoon@openwall.com>
Signed-off-by: NDan Carpenter <error27@gmail.com>
Signed-off-by: NAnton Vorontsov <cbouatmailru@gmail.com>
上级 8477cedb
......@@ -87,6 +87,10 @@ static int __devinit gpio_charger_probe(struct platform_device *pdev)
}
gpio_charger = kzalloc(sizeof(*gpio_charger), GFP_KERNEL);
if (!gpio_charger) {
dev_err(&pdev->dev, "Failed to alloc driver structure\n");
return -ENOMEM;
}
charger = &gpio_charger->charger;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册