aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-04-25 11:47:02 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-25 11:43:24 -0700
commita1d26ac0ddc4ea561e17a75dd3b5f9d3c1812f16 (patch)
tree79cb1ad0ccb5b8469be07710b5576c015b899c98 /drivers
parentlib/kobject.c : Remove redundant check in create_dir (diff)
downloadlinux-dev-a1d26ac0ddc4ea561e17a75dd3b5f9d3c1812f16.tar.xz
linux-dev-a1d26ac0ddc4ea561e17a75dd3b5f9d3c1812f16.zip
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')
-rw-r--r--drivers/extcon/extcon_class.c2
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)
}
edev->dev = kzalloc(sizeof(struct device), GFP_KERNEL);
+ if (!edev->dev)
+ return -ENOMEM;
edev->dev->parent = dev;
edev->dev->class = extcon_class;
edev->dev->release = extcon_dev_release;