Skip to content

Commit

Permalink
Extcon: check for allocation failure
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Apr 25, 2012
1 parent 6b96061 commit a1d26ac
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/extcon/extcon_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a1d26ac

Please sign in to comment.