Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: dwc3: qcom: use scoped device node handling to simplify error paths

Obtain the device node reference with scoped/cleanup.h to reduce error
handling and make the code a bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/20240814-b4-cleanup-h-of-node-put-usb-v1-7-95481b9682bc@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Krzysztof Kozlowski and committed by
Greg Kroah-Hartman
a85f13d5 34e8df2f

+5 -6
+5 -6
drivers/usb/dwc3/dwc3-qcom.c
··· 4 4 * Inspired by dwc3-of-simple.c 5 5 */ 6 6 7 + #include <linux/cleanup.h> 7 8 #include <linux/io.h> 8 9 #include <linux/of.h> 9 10 #include <linux/clk.h> ··· 703 702 static int dwc3_qcom_of_register_core(struct platform_device *pdev) 704 703 { 705 704 struct dwc3_qcom *qcom = platform_get_drvdata(pdev); 706 - struct device_node *np = pdev->dev.of_node, *dwc3_np; 705 + struct device_node *np = pdev->dev.of_node; 707 706 struct device *dev = &pdev->dev; 708 707 int ret; 709 708 710 - dwc3_np = of_get_compatible_child(np, "snps,dwc3"); 709 + struct device_node *dwc3_np __free(device_node) = of_get_compatible_child(np, 710 + "snps,dwc3"); 711 711 if (!dwc3_np) { 712 712 dev_err(dev, "failed to find dwc3 core child\n"); 713 713 return -ENODEV; ··· 717 715 ret = of_platform_populate(np, NULL, NULL, dev); 718 716 if (ret) { 719 717 dev_err(dev, "failed to register dwc3 core - %d\n", ret); 720 - goto node_put; 718 + return ret; 721 719 } 722 720 723 721 qcom->dwc3 = of_find_device_by_node(dwc3_np); ··· 726 724 dev_err(dev, "failed to get dwc3 platform device\n"); 727 725 of_platform_depopulate(dev); 728 726 } 729 - 730 - node_put: 731 - of_node_put(dwc3_np); 732 727 733 728 return ret; 734 729 }