gpio-charger: Check result of kzalloc
Since kzalloc can return NULL we have to check its result. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Vasiliy Kulikov <segoon@openwall.com> Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
This commit is contained in:
parent
8477cedb49
commit
2e9ff5f5e4
1 changed files with 4 additions and 0 deletions
|
@ -87,6 +87,10 @@ static int __devinit gpio_charger_probe(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
gpio_charger = kzalloc(sizeof(*gpio_charger), GFP_KERNEL);
|
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;
|
charger = &gpio_charger->charger;
|
||||||
|
|
||||||
|
|
Reference in a new issue