Skip to content

Commit bceb418

Browse files
gaurijhangianiFelipe Balbi
authored and
Felipe Balbi
committed
usb: dwc3: st: Add of_dev_put() in probe function
In function st_dwc3_probe, variable child_pdev takes the value returned by of_find_device_by_node, which gets a device pointer but does not put it. If child_pdev is not put before the probe function returns, it may cause a reference leak. Hence put child_pdev after its last usage. Issue found with Coccinelle. Reviewed-by: Patrice Chotard <[email protected]> Signed-off-by: Nishka Dasgupta <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent e36721b commit bceb418

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/usb/dwc3/dwc3-st.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ static int st_dwc3_probe(struct platform_device *pdev)
274274

275275
dwc3_data->dr_mode = usb_get_dr_mode(&child_pdev->dev);
276276
of_node_put(child);
277+
of_dev_put(child_pdev);
277278

278279
/*
279280
* Configure the USB port as device or host according to the static

0 commit comments

Comments
 (0)