diff options
author | Syed Rafiuddin <srafiuddin@nvidia.com> | 2012-09-03 17:00:11 +0530 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2012-09-11 12:47:42 -0700 |
commit | 05b0eb86396e81907f319b0934d90fcae3b09cae (patch) | |
tree | 5bdb112e171d56ec4859d26e59c11742346d1c63 /drivers/extcon | |
parent | 8ca20788912f5000fb090b2cd5a2423b7e91926d (diff) |
Extcon: check for allocation failure
Return -ENOMEM if the kmalloc() fails.
(cherry picked from commit a1d26ac0ddc4ea561e17a75dd3b5f9d3c1812f16)
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>
Change-Id: Id9b7b83dd08ea2cffb55b3922bac2d3c2a1725ce
Signed-off-by: Syed Rafiuddin <srafiuddin@nvidia.com>
Reviewed-on: http://git-master/r/130613
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
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) } 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; |