diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2010-11-18 17:08:37 -0500 |
---|---|---|
committer | Anton Vorontsov <cbouatmailru@gmail.com> | 2010-12-21 18:27:30 -0500 |
commit | 2e9ff5f5e4c6b034554f3539f29529265279102c (patch) | |
tree | fce7b8d464a06eec1f162d3f4d2132f9baa9ad4c /drivers/power | |
parent | 8477cedb49c69ce64b603d76c7776811eec0f9d7 (diff) |
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>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/gpio-charger.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/power/gpio-charger.c b/drivers/power/gpio-charger.c index fccbe99b619c..8458cafcd2b2 100644 --- a/drivers/power/gpio-charger.c +++ b/drivers/power/gpio-charger.c | |||
@@ -87,6 +87,10 @@ static int __devinit gpio_charger_probe(struct platform_device *pdev) | |||
87 | } | 87 | } |
88 | 88 | ||
89 | gpio_charger = kzalloc(sizeof(*gpio_charger), GFP_KERNEL); | 89 | gpio_charger = kzalloc(sizeof(*gpio_charger), GFP_KERNEL); |
90 | if (!gpio_charger) { | ||
91 | dev_err(&pdev->dev, "Failed to alloc driver structure\n"); | ||
92 | return -ENOMEM; | ||
93 | } | ||
90 | 94 | ||
91 | charger = &gpio_charger->charger; | 95 | charger = &gpio_charger->charger; |
92 | 96 | ||