mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-10 12:34:07 +08:00
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>
This commit is contained in:
parent
6b9606106b
commit
a1d26ac0dd
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user