提交 0c582408 编写于 作者: H Himangi Saraogi 提交者: Felipe Balbi

usb: phy: drop kfree of devm_kzalloc's data

Using kfree to free data allocated with devm_kzalloc causes double frees.

The Coccinelle semantic patch that fixes this problem is as follows:

// <smpl>
@@
expression x;
@@

x = devm_kzalloc(...)
...
?-kfree(x);
// </smpl>
Reviewed-by: NJingoo Han <jg1.han@samsung.com>
Acked-by: NJulia Lawall <julia.lawall@lip6.fr>
Signed-off-by: NHimangi Saraogi <himangi774@gmail.com>
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 2c4e3dbf
......@@ -260,10 +260,8 @@ static int gpio_vbus_probe(struct platform_device *pdev)
gpio_vbus->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg),
GFP_KERNEL);
if (!gpio_vbus->phy.otg) {
kfree(gpio_vbus);
if (!gpio_vbus->phy.otg)
return -ENOMEM;
}
platform_set_drvdata(pdev, gpio_vbus);
gpio_vbus->dev = &pdev->dev;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册