diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-04-25 04:47:02 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-25 14:43:24 -0400 |
commit | a1d26ac0ddc4ea561e17a75dd3b5f9d3c1812f16 (patch) | |
tree | 79cb1ad0ccb5b8469be07710b5576c015b899c98 /drivers/extcon | |
parent | 6b9606106ba58d2bd80610f97e06fea58206b47c (diff) |
Extcon: check for allocation failure
Return -ENOMEM if the kmalloc() fails.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/extcon')
-rw-r--r-- | drivers/extcon/extcon_class.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/extcon/extcon_class.c b/drivers/extcon/extcon_class.c index dbd3bfba42da..53c64a98b0be 100644 --- a/drivers/extcon/extcon_class.c +++ b/drivers/extcon/extcon_class.c | |||
@@ -621,6 +621,8 @@ int extcon_dev_register(struct extcon_dev *edev, struct device *dev) | |||
621 | } | 621 | } |
622 | 622 | ||
623 | edev->dev = kzalloc(sizeof(struct device), GFP_KERNEL); | 623 | edev->dev = kzalloc(sizeof(struct device), GFP_KERNEL); |
624 | if (!edev->dev) | ||
625 | return -ENOMEM; | ||
624 | edev->dev->parent = dev; | 626 | edev->dev->parent = dev; |
625 | edev->dev->class = extcon_class; | 627 | edev->dev->class = extcon_class; |
626 | edev->dev->release = extcon_dev_release; | 628 | edev->dev->release = extcon_dev_release; |