mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
gpio-charger: Check result of kzalloc
Since kzalloc can return NULL we have to check its result. Signed-off-by: Lars-Peter Clausen <[email protected]> Signed-off-by: Vasiliy Kulikov <[email protected]> Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Anton Vorontsov <[email protected]>
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);
|
||||
if (!gpio_charger) {
|
||||
dev_err(&pdev->dev, "Failed to alloc driver structure\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
charger = &gpio_charger->charger;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue