提交 a1d26ac0 编写于 作者: D Dan Carpenter 提交者: Greg Kroah-Hartman

Extcon: check for allocation failure

Return -ENOMEM if the kmalloc() fails.
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Acked-by: NMyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 6b960610
...@@ -621,6 +621,8 @@ int extcon_dev_register(struct extcon_dev *edev, struct device *dev) ...@@ -621,6 +621,8 @@ int extcon_dev_register(struct extcon_dev *edev, struct device *dev)
} }
edev->dev = kzalloc(sizeof(struct device), GFP_KERNEL); edev->dev = kzalloc(sizeof(struct device), GFP_KERNEL);
if (!edev->dev)
return -ENOMEM;
edev->dev->parent = dev; edev->dev->parent = dev;
edev->dev->class = extcon_class; edev->dev->class = extcon_class;
edev->dev->release = extcon_dev_release; edev->dev->release = extcon_dev_release;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册