From patchwork Wed Aug 14 10:35:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13763303 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E1ACCC52D7B for ; Wed, 14 Aug 2024 10:37:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=yHFYh1Cx+x4Cu70WZybitfJUp7k6hKw0CFTnTWoMGIs=; b=VoyFW08G5O9jZiWXp7dvntaiXp CChx+f3ro+KMK+eNBZhBhtQJtmJFhZ4blignNJmI29kBRTXvb/YvtUCxEIoEA7By+HpLi+J/CjLZW d2dyaGCc3e6P7w7C/bAS7uKxp9IeGVm0y9+mspTN3a5YGKuWz7J1RvI83HJ0gUBQx0RrBWH0+LJx3 A+A8d6nAGQO0GRNkVaKxMnyMsJC7lmAIkrW3XOVoKb240f4TtKMwI2IpPDfn7TdD5Fg24hu+52331 PNWv3McSAEfCnbF/llibfOCYdxmnCsqE5+F0BCcLfUnEWcdvZvxvFwQofMendY9Ipxw6wyWqsfTWV Lhx0r8FA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBNQ-00000006dB5-1KKR; Wed, 14 Aug 2024 10:37:12 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBMF-00000006cqM-1SIP for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 10:36:00 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-530e2548dfdso6881395e87.1 for ; Wed, 14 Aug 2024 03:35:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723631757; x=1724236557; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=yHFYh1Cx+x4Cu70WZybitfJUp7k6hKw0CFTnTWoMGIs=; b=f5mBPzLDh7slb4IE4n+fW5yfOupL1m1bzFDi6vbMJIPk3Y2YOO8EtxkMlM/RErrunC uTi2HQjD4vYU+dJ4gPuU0dBkVemNeZMicFd/5jpy6FUF3N9JE3Rtu84YhSmFSOyec+5N lCCcIDFxjJ3AfPdzUWKPxb20Ll+qDKB+jlLGV2DvWRJEJ11CRlXT5cLtnrkMmBdEzOmA RZNdena5NbHct69dgN4OHSTq22rhJz6K5emFaCj6zWMZIlH1L1EroMIAeuigET6eFVUu ytSS8uKwYp3jKyfqF67HYWQ+cr5b0jLCC1yUR1T6LvpusQeGZ3UPDPq99IH37f8MkogC wTrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723631757; x=1724236557; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yHFYh1Cx+x4Cu70WZybitfJUp7k6hKw0CFTnTWoMGIs=; b=oR4KxFzYyfj+HyulVSDUpqfZblpzPsUaEl3DSqijB3DFEAbcHzF33GznxtCQkzZ0eI JlszTrq+L6bte+WXwGyFr8yDluoQJ/340Xa1F22Qm3aVF5XQL+XaeXahLgDITkpttPpm NUcz6xdW1/Lf6lB7+kpxmTKiGnX9Qojq71ixzj3eJQHL2mxA3+lD+2+bc1r2nlyLdu2W nBrySH5H0/9yFwGAFn3ueviC1hWNJ3XmmZnhc4xDKJtxA1ReR5YIGkY4FvDHPxMOUMoe /BYOP4OOgUE7MqlW8766kfucYOgrNGrMQ5ZFdfOCzHxYuiK8UwQepGhPzfhV6MxUdGPH Ug7g== X-Gm-Message-State: AOJu0Ywk5vD82aVA3uZYRrYhX1i4KCcQnHIMyWzJ721ZyLkk6HpMUXGi eGE2vYarTsWwow1VpO5A1xr9YtzB/amO+wGSD0Vxw6jhYH/FFVsKwNf0emTyE6E= X-Google-Smtp-Source: AGHT+IG969TFpPgU1+5jbbATSkjp3FOj4nyLgR0kdKAtRZ/slzlU8orv4hZlF4g3iItwYFiyM8i9Zw== X-Received: by 2002:a05:6512:10d5:b0:52c:d56f:b2cc with SMTP id 2adb3069b0e04-532edbcc0f5mr1485533e87.58.1723631757096; Wed, 14 Aug 2024 03:35:57 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded3dd4dsm15501835e9.29.2024.08.14.03.35.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 03:35:56 -0700 (PDT) From: Krzysztof Kozlowski Date: Wed, 14 Aug 2024 12:35:37 +0200 Subject: [PATCH 01/11] usb: dwc3: st: use scoped device node handling to simplify error paths MIME-Version: 1.0 Message-Id: <20240814-b4-cleanup-h-of-node-put-usb-v1-1-95481b9682bc@linaro.org> References: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> In-Reply-To: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> To: Patrice Chotard , Thinh Nguyen , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Michal Simek Cc: linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3220; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=EFpd5/+dfOnJ8CRGGEqG1pEkOch4M8T0ltcfE8+XutU=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvIh/KTrLZD7u68/muOtkJgyWPEAQfePrGpnM9 QQAGl427iCJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZryIfwAKCRDBN2bmhouD 1zo4D/oCOGQPygqo0iW6HAtrAzZlIUOaNfwcp9iCj/Ano/8e5IrnUGFyuT7eMCpLXYpDrma27st DnqxrqJQ8RjjlTsb9TqjTs9CNh80OFAVvSi4sJmRZVfJbjXPp6zcO2X/ws1VvUhNYAQfh86Egy4 Rp+3kJrzjTKMSZxPgGGPQNhT7CFoEFtViM16h6JqCOgCzg/nN1FedbckC9IZ2Wz7wRbP/XV8QQ6 jyB5IyrboscOby2kvjZVXDcjZnFYqeCiNIp2xKxzh3++K4wU+py49dy+rI0wxtieuO1dFxHEU1K CO1q0FgG2e1q32wsr8tVFDX7NamjBQCFRKprLzATS2vJvtljz3VBq2pMr8lMwoC1JZ7w3BPTPgs XUjoiT0heBfbAFkM++5xexqBtarVug08K6eUMQwylhKiOe9ohfxkYKIZTWpvMbb+S07gItrAoWv UkQDT3LqXC88GJsXovIX4dzhF6moMmJTezJ9kXjFqAqJvDRKH0DN97YHAJzBgvzoW5qxijKeygY jSNFmJ6pXUrMcvs/db3Xijh3MP2wOpqE7I3VvVMTaZ5pJVIOvzE4XjODMfUqMDDrLQzSBuWz9lJ wFx7OSOPbUbZ92fyD0g12BeZlZ3RC61RBI88KT3P+kt/FtcWtui9H7XbQjMvviKXgHKTGUcgUB6 Bk0KetBjwiweuGw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240814_033559_423513_906CD3B3 X-CRM114-Status: GOOD ( 16.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Obtain the device node reference with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Scoped/cleanup.h coding style expects variable declaration with initialization, so the of_get_compatible_child() call has to be moved earlier, before any goto jumps happen. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Patrice Chotard Acked-by: Thinh Nguyen --- This depends on my earlier fix: https://lore.kernel.org/all/20240814093957.37940-2-krzysztof.kozlowski@linaro.org/ --- drivers/usb/dwc3/dwc3-st.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c index c8c7cd0c1796..98f43d7082d7 100644 --- a/drivers/usb/dwc3/dwc3-st.c +++ b/drivers/usb/dwc3/dwc3-st.c @@ -14,6 +14,7 @@ * Inspired by dwc3-omap.c and dwc3-exynos.c. */ +#include #include #include #include @@ -197,7 +198,7 @@ static int st_dwc3_probe(struct platform_device *pdev) struct st_dwc3 *dwc3_data; struct resource *res; struct device *dev = &pdev->dev; - struct device_node *node = dev->of_node, *child; + struct device_node *node = dev->of_node; struct platform_device *child_pdev; struct regmap *regmap; int ret; @@ -227,6 +228,13 @@ static int st_dwc3_probe(struct platform_device *pdev) dev_vdbg(&pdev->dev, "glue-logic addr 0x%pK, syscfg-reg offset 0x%x\n", dwc3_data->glue_base, dwc3_data->syscfg_reg_off); + struct device_node *child __free(device_node) = of_get_compatible_child(node, + "snps,dwc3"); + if (!child) { + dev_err(&pdev->dev, "failed to find dwc3 core node\n"); + return -ENODEV; + } + dwc3_data->rstc_pwrdn = devm_reset_control_get_exclusive(dev, "powerdown"); if (IS_ERR(dwc3_data->rstc_pwrdn)) { @@ -248,18 +256,11 @@ static int st_dwc3_probe(struct platform_device *pdev) /* Manage SoftReset */ reset_control_deassert(dwc3_data->rstc_rst); - child = of_get_compatible_child(node, "snps,dwc3"); - if (!child) { - dev_err(&pdev->dev, "failed to find dwc3 core node\n"); - ret = -ENODEV; - goto err_node_put; - } - /* Allocate and initialize the core */ ret = of_platform_populate(node, NULL, NULL, dev); if (ret) { dev_err(dev, "failed to add dwc3 core\n"); - goto err_node_put; + goto undo_softreset; } child_pdev = of_find_device_by_node(child); @@ -270,7 +271,6 @@ static int st_dwc3_probe(struct platform_device *pdev) } dwc3_data->dr_mode = usb_get_dr_mode(&child_pdev->dev); - of_node_put(child); platform_device_put(child_pdev); /* @@ -282,8 +282,7 @@ static int st_dwc3_probe(struct platform_device *pdev) ret = st_dwc3_drd_init(dwc3_data); if (ret) { dev_err(dev, "drd initialisation failed\n"); - of_platform_depopulate(dev); - goto undo_softreset; + goto depopulate; } /* ST glue logic init */ @@ -294,8 +293,6 @@ static int st_dwc3_probe(struct platform_device *pdev) depopulate: of_platform_depopulate(dev); -err_node_put: - of_node_put(child); undo_softreset: reset_control_assert(dwc3_data->rstc_rst); undo_powerdown: From patchwork Wed Aug 14 10:35:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13763304 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 23AA8C52D7B for ; Wed, 14 Aug 2024 10:38:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MYbj97TWkeN06uXs3dFmCbhWF9ptmDF/h8TBQ2K7IzM=; b=XI7xvzleIJvR7KReSgYvcXmQ5w 8shjB+/d2GnvBvAvUB/JInOyrbE7rIINhQJ7mH9S8qvsJvf5KLjfxXaSVM89TXlTRdaqZEo+PDSOS VEOPMW3UlZFYF1hatzVBcku6wulxShB3DR3BjEHbSFDGwkwLnb8uX9A3XiAofU/1BMUmx97vV/hGc rYmaPywut7VfVuKby75kYX5CeWHh0zRgVffSMnQbcarduPCH4khsegnzK8oA1nR9sy0Kne0Vk+LHL XpqxlAQ1MGxmOgUIYF2Cws5E/oc/c4JN26b4EpkHfWN8zU6ukUqk262BPmeP1ewjfs9rJqMdUGu7Y nSKqFfXg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBO0-00000006dME-3WBd; Wed, 14 Aug 2024 10:37:48 +0000 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBMH-00000006cqq-0HhN for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 10:36:02 +0000 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2eeb1ba0481so86983551fa.2 for ; Wed, 14 Aug 2024 03:36:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723631759; x=1724236559; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=MYbj97TWkeN06uXs3dFmCbhWF9ptmDF/h8TBQ2K7IzM=; b=HDmxqeoz/za6f8whWFbfzMgymlWAg4oKHiB7LX/vnjEvd2UfCsAQKKYtz1jxfp7NJH o6o+cTxifR6SrXrjdjt6/sF1UTZo99QSj4L7uFmhVsHQChlXeZeb5bpRwTvwKang+8XB JypvNT7Kd+7Iu9zQBPG+o1fPzXKNaEF1niBO1L2IqAZx2A3E5jc+QlrD/vz4ORWE3BkX r2lvmhE34kIc/tsHKdP1kOrgSmzSyFbtD1K74oYfm7T+JN08RHG1LUAYxRD7L8PAa7So cAxO+sgLu5O4b0S6OqOc7w4RV4gqzpMShQ00P+01TGeglv6UTV44a/3gw+q1/fsm9r5J 6k6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723631759; x=1724236559; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MYbj97TWkeN06uXs3dFmCbhWF9ptmDF/h8TBQ2K7IzM=; b=DyqNJRmjtBXlHe15h7N/p519iJTf7xQqJZEREQ4HqsFI5etZWjms3HgptUCk6o3Age S6FN7O+bjP38sZLpXl3uRuqt/YoA3ZUowzUeqEFlL+54+DJ2U+vKCwFKQcTwjmUCHAFB sWAs8sDTJ+wMC+BOZpL9mY7D6OP04mL7DgjwNMKTmnN0z66MWdrNDDE+d+3wvndBKOKo TT2XmDWCEk2Y49B+LAhhFltBy8XX9tJ87NTHr95kFBiEpeI8vkwZNTktAKaGK2twKbZQ aODYWsDFBl56HjH4uOLOD85s5OHgDaeqRCRJHStUFdy+Wmr72vGZMSPvr9urxhC+j0NJ cHQA== X-Gm-Message-State: AOJu0YyMB9bzOUV3fIq54tQH3snw0M9XgaFhDIxid1OIdAbvl0drhLFL +QApsrtd0iL9DNdsu6S4IiWjBNHnk8dsbgJnYzhFFtc18e3XmH1+x2q3NH2IbUc= X-Google-Smtp-Source: AGHT+IGNnEvKYgHjOlM+F8zslJoez+32u1bT6xmeFHQ2/ZeUJOaLf7dk5BPLnJuHX9IuZgxjc9jlDA== X-Received: by 2002:a2e:3003:0:b0:2ef:2685:177d with SMTP id 38308e7fff4ca-2f3aa1f1bb2mr14654091fa.20.1723631758721; Wed, 14 Aug 2024 03:35:58 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded3dd4dsm15501835e9.29.2024.08.14.03.35.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 03:35:58 -0700 (PDT) From: Krzysztof Kozlowski Date: Wed, 14 Aug 2024 12:35:38 +0200 Subject: [PATCH 02/11] usb: dwc3: st: simplify with dev_err_probe MIME-Version: 1.0 Message-Id: <20240814-b4-cleanup-h-of-node-put-usb-v1-2-95481b9682bc@linaro.org> References: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> In-Reply-To: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> To: Patrice Chotard , Thinh Nguyen , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Michal Simek Cc: linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1399; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=vskeAuKrhfXrsp2ZcFFQuCibXtmv9qVHOZR6L6FnN20=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvIiApf/404hSWCwrTIbqTV+JJM3N30EgD7ku7 Zsz1Z4gWiqJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZryIgAAKCRDBN2bmhouD 18wpD/4m8mmVOueU/GuhjZB2g27J7VlVXkK0jkGm7TFlyRFyiF2XYlGnZqaXOpmN0ESdexzXM3d slE+ElE1ppbQkvNFg4aDQFGuxXKY5IWMAv5FJuXs0kohxCvZTGEvIfpymJ+4pTxjS23v8AGhCxW bdN783ZthKaw+vTytIyOKbW5fA3V6XB0fssYWKvgmB926my9VU2zj1hB2Ww2uLaDUN7rdxInGZy o44duqg10/m+duq+7L5UhVy2yL1VHdqea4/1L+C3s3r42BeDQeEnLjfjv8wg/RPF6VOj0mgjktr SOEZIc7ui6Rj18eXhhyl2TWGfyv0pLmtzy1dqbiiJzKaNRyuIcsN3TwCURpYL3AjLGILkaf+8M9 j0MDj697885SoSa0Fn33q9oscQEKDYIwew3dzxTSrftVIKM279oy3uUAHYV2Td5IwxhxlWxJ045 x0KM/mgjF9SSI623mjdZ+Xnr85ZjSix/n0Frwzt18U2CtpgyzHfoT9pvtNGcTwWmCysOHxK21EM 2CK7iNGaZDhuKbff2tKDpcxPOeXa+V+WISeWC5Cd1UrD7Oz3zWACUeBfYxcUTsSr8wjpWnmfPZd uYeQxAeN1KZO/G1CwTfshZ15a/I+ku52qqz0t0YHnKo4SomBpymirVhv/RSgnsUW1Ld9Pxbhs0w xtXyrU6Q4UlpCtg== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240814_033601_269983_6141F957 X-CRM114-Status: GOOD ( 12.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use dev_err_probe() to make the error paths a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Patrice Chotard Acked-by: Thinh Nguyen --- drivers/usb/dwc3/dwc3-st.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c index 98f43d7082d7..7a0b1821768a 100644 --- a/drivers/usb/dwc3/dwc3-st.c +++ b/drivers/usb/dwc3/dwc3-st.c @@ -237,10 +237,9 @@ static int st_dwc3_probe(struct platform_device *pdev) dwc3_data->rstc_pwrdn = devm_reset_control_get_exclusive(dev, "powerdown"); - if (IS_ERR(dwc3_data->rstc_pwrdn)) { - dev_err(&pdev->dev, "could not get power controller\n"); - return PTR_ERR(dwc3_data->rstc_pwrdn); - } + if (IS_ERR(dwc3_data->rstc_pwrdn)) + return dev_err_probe(dev, PTR_ERR(dwc3_data->rstc_pwrdn), + "could not get power controller\n"); /* Manage PowerDown */ reset_control_deassert(dwc3_data->rstc_pwrdn); @@ -248,8 +247,8 @@ static int st_dwc3_probe(struct platform_device *pdev) dwc3_data->rstc_rst = devm_reset_control_get_shared(dev, "softreset"); if (IS_ERR(dwc3_data->rstc_rst)) { - dev_err(&pdev->dev, "could not get reset controller\n"); - ret = PTR_ERR(dwc3_data->rstc_rst); + ret = dev_err_probe(dev, PTR_ERR(dwc3_data->rstc_rst), + "could not get reset controller\n"); goto undo_powerdown; } From patchwork Wed Aug 14 10:35:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13763305 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A0CCFC3DA4A for ; Wed, 14 Aug 2024 10:38:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TblL9Z19XAohhrkaXRX6MPVRFbSGmMy0aOK/sLyoZUY=; b=iYXqk+KaDNGepAYLRZ5AmDRZpe FJHf4JhcSOCma6UK9VR5ERUZW4OimY/aGaNKIjnCsqD3x3+vmkhG2vmhVpR65ysWMTJmJL5OUqnXo DrKtYBS3WcyFtXqVxI7uVr15LK2SMe0WQO5Kst2qGzD7910gKCY3tjFLUfU35HNzXAzwk5RQPYvKh YIGqdjNBNXQ11lLg2TwlPWvzJqaiVoqLWgH8fWeIu1RaeBx5sNJCJnGD5ywzFeSt442xEQm6qFqFc 1z23fv1MzicyVPeF9jA67OWM4lyBLYsbPyQLH+oO7teVrJ55gQ1MSoJld6KHjjZsLdTCC+qlK2L/4 NxsItfmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBOb-00000006dXk-1wkI; Wed, 14 Aug 2024 10:38:25 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBMI-00000006crC-1E7o for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 10:36:03 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-428f5c0833bso4163315e9.0 for ; Wed, 14 Aug 2024 03:36:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723631761; x=1724236561; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=TblL9Z19XAohhrkaXRX6MPVRFbSGmMy0aOK/sLyoZUY=; b=eQB/haWrpj+OHGr2Afxgdyq8GJUQvaURQCKjTsEakIMHouPpYgozBMBEIxz4Lwv3RB MgEZH6aI3QoWvObiCK7xtf7kGzbKmaJZery2D8zxMwSMWJYUMTqGdappTSPhWsnoPX6s PFfk26ASBes4RKgvfp5DGEVAC7RQBw8W5i+FqxnH8gxEOfqzTg1MUX1MpwkcKBCfU+MY omrk45NkqfkU3rAMSTGI8iC1324OHOXoDKsZEM716vt+8BHbF/iEV6BtpVc6XLnFSJW5 Bvgd3xMdNAM6ZIRGu6BqG2c3QVy245s5cB+dhTm7MQtgC1ZoB+EKh09B9Me3biEwDXJz Ocnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723631761; x=1724236561; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TblL9Z19XAohhrkaXRX6MPVRFbSGmMy0aOK/sLyoZUY=; b=Y0leHWUWfVFkcW8DeouZ+m3/Vjh3SVvMgg9AJueYOmBEBF6w5qUB+Yy+fbpVjtlWjg w/XZgJhIJd/VhBKt39sG9tdVcmh6p77MssqWXAv/UX+H39iJ5Mqky1IZyM32lqpgrkK0 H4fNiwVs5nQXlzzD9JbXZwIBWJq5A3hvWVUavAymuZk8T56LLaXr0Ro4RRSFNANmzFg6 EoYCzEV+tFXqCIZCItlUMxkgo7lxHOjnMZNvjjhfQUuuaKVth1KpauNi2uOed/EdTdrb IieFo+P0JIfOTpzpqEClLygLlynvzQ6MeRZCCvrY98ee+YHOUk4Mha1cOUdzVdApOEfX GRRw== X-Gm-Message-State: AOJu0Yxjd2zF+N/jTHXM4Og0hvZdh2iVw6C5NqYeTG1rUHa6cWV4ePKH dZZ/k1Z2yzzNVKVOH4O6GOc7yg4a7xvQoelJW+RXSz/JTW6T3cQ0af+qeeBBF3A= X-Google-Smtp-Source: AGHT+IEdI2fPfqb0zb5Eip7GDLT8WAfJbIcdmN8zHY3NjYo91M3bh3D1x8MPYOeryuxOSX6c+LjblQ== X-Received: by 2002:a05:600c:1d24:b0:424:895c:b84b with SMTP id 5b1f17b1804b1-429deea537fmr12997075e9.4.1723631760814; Wed, 14 Aug 2024 03:36:00 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded3dd4dsm15501835e9.29.2024.08.14.03.35.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 03:35:59 -0700 (PDT) From: Krzysztof Kozlowski Date: Wed, 14 Aug 2024 12:35:39 +0200 Subject: [PATCH 03/11] usb: dwc3: st: simplify pdev->dev usage MIME-Version: 1.0 Message-Id: <20240814-b4-cleanup-h-of-node-put-usb-v1-3-95481b9682bc@linaro.org> References: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> In-Reply-To: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> To: Patrice Chotard , Thinh Nguyen , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Michal Simek Cc: linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1029; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=TFH+4tMh9QXGQRjmYFo8ohxscUnzlx/tT6fY+TrZKG0=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvIiBpIEfWgrpGhUt9gg7zd995/w3Rni7GrFxR QazCeDTFx+JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZryIgQAKCRDBN2bmhouD 17zZD/0V53NfF3yWdAvXnXh9hLWejd4wiyYVZoOefkdRoPhetU8Jcy+fHjQkGZU4coKf887uX4D qxp1eOBcED60oYovUPtNMcWgdN2v2TLhD0nQXSs1mw8JEFMcU8jLv55XMbqDFW/aA1nWpXarf8v KlkMX8r8WCtVbyuSB2W4SDaI8R30CrirvMy2wKtQcJZ3C6VqL0PLkc98FMzhb5+wJFMduDa01XT OD+7AzldNfiZ8LzG6lcZ47D+qCpN0PbiyU7yvYPRS7CQS8IWdraUMQxP7hd3Yrp3SFrJBEJj8V/ aU/nNJRnFnGsRK25n0BaTXMzHiC7TU7AOICyfIOdMUTNoeggWHly6QWkRs/RopjIfKmX/4iEi7m Ta6A7qon1pCJah8PkqlOTtHyPS7h7HpT2AGfCCbDrHWzmGp7HJb10yEEM+tPXxgYTxiGsCeGBRu w8WaYcC0S/Ss5AtqbKyGBlOAHTPxYSA2/7JqaP5hZ0DvxiotsGm6Xaw4ZeoY8auUnN4TbwQXay5 oZTuUhSkVSBZzc45PE1U//rJeLfjU/xFP8XRNCGFAD5w41C750Bb+SyQlDAcyoz5gcmHuuHzWi2 STH1qG7JRIrLsCOYAmiyA7hPfbtGyv1nnPRXiCzleDha0TkfUq+1dhACtnEdjGuJdCgwmYHhN1K HTKH+VGcd9JStdA== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240814_033602_364184_DADB835C X-CRM114-Status: GOOD ( 12.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The probe() function already stores '&pdev->dev' in local 'dev' variable. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Patrice Chotard Acked-by: Thinh Nguyen --- drivers/usb/dwc3/dwc3-st.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c index 7a0b1821768a..2841021f3557 100644 --- a/drivers/usb/dwc3/dwc3-st.c +++ b/drivers/usb/dwc3/dwc3-st.c @@ -225,13 +225,13 @@ static int st_dwc3_probe(struct platform_device *pdev) dwc3_data->syscfg_reg_off = res->start; - dev_vdbg(&pdev->dev, "glue-logic addr 0x%pK, syscfg-reg offset 0x%x\n", + dev_vdbg(dev, "glue-logic addr 0x%pK, syscfg-reg offset 0x%x\n", dwc3_data->glue_base, dwc3_data->syscfg_reg_off); struct device_node *child __free(device_node) = of_get_compatible_child(node, "snps,dwc3"); if (!child) { - dev_err(&pdev->dev, "failed to find dwc3 core node\n"); + dev_err(dev, "failed to find dwc3 core node\n"); return -ENODEV; } From patchwork Wed Aug 14 10:35:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13763306 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D7E45C3DA4A for ; Wed, 14 Aug 2024 10:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1cqO+4rAxBNRyDDhNBHedGtky2fSXIy5hPBgThD6ecM=; b=CwpjA7j5nvl3bN1pVE5GBveYUE xqNziuNNKCB1LvJQVBSHA8H/1n0x9MDmh1/UCkoE87LjwQ63bNUbUCQNR/H+7a75QCVD61slGe29a gWPBLRXNkZU1CWdZ0+i2ywYOsY7qKevZHiQYhwiFA4cD8VIzlk21LqU+y1NZ6Z5d4H5qrbN5EZfNV 0fCbcKseBpjlyCVf+7Fnn+mDnlXdMSciJFqmEemEQB55ip/9fqJTb/jQn2qlewiDsAzgBeaD0FSD3 ZHquclOSQ/99nGapXd7XN1poot9dTxFH2T4OK6Xsa8BF2A77e3i8AAuDpqRoKE9Fx3H7wUtMDEpps 93/grhIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBPB-00000006djp-48Y9; Wed, 14 Aug 2024 10:39:01 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBMK-00000006crq-2fdJ for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 10:36:05 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-429d2d7be1eso4249005e9.1 for ; Wed, 14 Aug 2024 03:36:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723631763; x=1724236563; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=1cqO+4rAxBNRyDDhNBHedGtky2fSXIy5hPBgThD6ecM=; b=ZJ6kCPYqTZJt1c5kh+x5xOe6vWkGIWXRpsIsvesYzyDCmtT26PJLRmv2ZIzEapKB7S 9tBotVSIvZw/KqLQRV3VoeJcT3s0LxWzXoABEqtt3frGLGhKxgvSzLaQkWFN3GNsBl5s V8DMNRtARA00buEsn6DUaEomwUuvr9jwkWpTxjhZUGww0quT+/JOD9uqGJFVenA6cB30 szkwRQePEhXKZNJ+f8nzBU7bEGqoTqg5icExc7P3SFwzCyECsn6J41HSjcT/cPiSdDw1 L1t60zUGvLnnm/XqA28lWeXLc7lbfjx7xp39gmCFpuR5L51n/JY0w8HsNuDD1bibt32+ ICyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723631763; x=1724236563; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1cqO+4rAxBNRyDDhNBHedGtky2fSXIy5hPBgThD6ecM=; b=LyQFymG6i3Ni4Vw7gJMo1n8jHpSnuV3iD6MX+kR9tdGzrLlOe2PD1Ob6BWeR3qSyAE hg7umcUq3+C/HiU7T1Wyp4wUOD3FO05ADKK10/eJzw0SPr8T5hPPptOulsISR70qpNma TZu8d1/z7c8ri+X3pXy1e2zAdKOTSsxiaLgEgY4/BYw+xT9quylFC++0hWr3Ao74D254 qYfUTGeyaj4qbMFX77J3so0AG/NRqxyCaCu+J8jvMfGykVwy3wA/m+b5h+eewBu98Lw7 wwBhLNH2pBqdxQjMNIgzJG4h8lW/TKylKTgSrLMmbBOIc6oARp8AFB/eHERJx1vB5PtW qP2A== X-Gm-Message-State: AOJu0YyVfKcsroIO8bujHn43cGdMM8ajH7sEexQUuG/2a0c/WypRAns/ 3rcGfIvuZFchrn/tP4Cu63UaRTG+gaf+m0oTlyxXgu6kbUlQr8hLYyQ3e7T+Qkk= X-Google-Smtp-Source: AGHT+IES2mQhu6MdPtwV64PYKAc4oDWsVzNHS1sfgfyJ1Y6SRvJ5KM7FhWMYBHfvz5L1Tw/i6VxzIw== X-Received: by 2002:a05:600c:3584:b0:426:6fb1:6b64 with SMTP id 5b1f17b1804b1-429d62a79fbmr48006525e9.7.1723631763306; Wed, 14 Aug 2024 03:36:03 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded3dd4dsm15501835e9.29.2024.08.14.03.36.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 03:36:01 -0700 (PDT) From: Krzysztof Kozlowski Date: Wed, 14 Aug 2024 12:35:40 +0200 Subject: [PATCH 04/11] usb: dwc3: imx8mp: simplify with devm_clk_get_enabled MIME-Version: 1.0 Message-Id: <20240814-b4-cleanup-h-of-node-put-usb-v1-4-95481b9682bc@linaro.org> References: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> In-Reply-To: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> To: Patrice Chotard , Thinh Nguyen , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Michal Simek Cc: linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2471; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=6w0FwQBoUqvtw1ZqzZIIkPCVnvDefZcLlt+ogevlVh8=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvIiCl78tzBS9uIuiF3Rohph/DlAc+GfXXGrOG eS+1ArbuWSJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZryIggAKCRDBN2bmhouD 1/DeD/48dKqEg1rZRiz6+hjkctEx6+iMDYay3/t3lA1ygHh67v6RO4XxGRvxqTGvRsK2fS1NAVt nA8+SHIKxwudDMHUcL0nYgrJ3ciLOR1rCtBTaX4jx/yC6PdLYm80L1xfttNU5CA0eMZzillE3RE zjP0SAEkmUZJer7hYR50bHM0AfbVkvaZAT4Q7nF3XcmlTyNkzWUjgpdvmgkzynJ5otGbquxP2d8 MiN+2ONYIf1dArLXBxR0Vo8qlEGk3fSRVEt0kTlP7+uviQSAuQUYZYkArFuWMjbFygXoKy53inQ cYRxJ/Y/GmZLUI8vJ3B8UmuXZlL2fYkiL8X0dshjEqJmNQVWU2D1IhXofBca7ltD7SrwKIWKhsR 5xio7cUFk3OoH033uk0BvKvK2DMyTUozZ0HdTaraIbfMR13Ir0kUTcjtg5q79c/VlMLLS0Z4N0M uWBmVkE4/KmOTIaTIAf+dshbxfwzVFm3025RRkOtYzqd2eZsV0Y/ugsxzWZyXKD0QdnhLJHxy+8 ae81x+rq5ZvI9w7MvLVywxABWKzD3Ien8yfGQ78UXlQ+WBijJDnECG3ujrVt5zxx9iIKcYlOEbf NIX34IibhiuhWA3LVdvPzTeohL/5uhTbmXh0SUqFhNDQrks02MaqnfIICErUuiXc5i6NXvFu8DD maKo0o+M5z7Xvtg== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240814_033604_709715_3818DFDF X-CRM114-Status: GOOD ( 14.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use devm_clk_get_enabled() to drop clock preparing and handling from error and remove paths. This makes the code a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Frank Li Acked-by: Thinh Nguyen --- drivers/usb/dwc3/dwc3-imx8mp.c | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c index 392fa1232788..8c91e595d3b9 100644 --- a/drivers/usb/dwc3/dwc3-imx8mp.c +++ b/drivers/usb/dwc3/dwc3-imx8mp.c @@ -178,37 +178,23 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) return PTR_ERR(dwc3_imx->glue_base); } - dwc3_imx->hsio_clk = devm_clk_get(dev, "hsio"); + dwc3_imx->hsio_clk = devm_clk_get_enabled(dev, "hsio"); if (IS_ERR(dwc3_imx->hsio_clk)) { err = PTR_ERR(dwc3_imx->hsio_clk); dev_err(dev, "Failed to get hsio clk, err=%d\n", err); return err; } - err = clk_prepare_enable(dwc3_imx->hsio_clk); - if (err) { - dev_err(dev, "Failed to enable hsio clk, err=%d\n", err); - return err; - } - - dwc3_imx->suspend_clk = devm_clk_get(dev, "suspend"); + dwc3_imx->suspend_clk = devm_clk_get_enabled(dev, "suspend"); if (IS_ERR(dwc3_imx->suspend_clk)) { err = PTR_ERR(dwc3_imx->suspend_clk); dev_err(dev, "Failed to get suspend clk, err=%d\n", err); - goto disable_hsio_clk; - } - - err = clk_prepare_enable(dwc3_imx->suspend_clk); - if (err) { - dev_err(dev, "Failed to enable suspend clk, err=%d\n", err); - goto disable_hsio_clk; + return err; } irq = platform_get_irq(pdev, 0); - if (irq < 0) { - err = irq; - goto disable_clks; - } + if (irq < 0) + return irq; dwc3_imx->irq = irq; imx8mp_configure_glue(dwc3_imx); @@ -259,25 +245,17 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) disable_rpm: pm_runtime_disable(dev); pm_runtime_put_noidle(dev); -disable_clks: - clk_disable_unprepare(dwc3_imx->suspend_clk); -disable_hsio_clk: - clk_disable_unprepare(dwc3_imx->hsio_clk); return err; } static void dwc3_imx8mp_remove(struct platform_device *pdev) { - struct dwc3_imx8mp *dwc3_imx = platform_get_drvdata(pdev); struct device *dev = &pdev->dev; pm_runtime_get_sync(dev); of_platform_depopulate(dev); - clk_disable_unprepare(dwc3_imx->suspend_clk); - clk_disable_unprepare(dwc3_imx->hsio_clk); - pm_runtime_disable(dev); pm_runtime_put_noidle(dev); } From patchwork Wed Aug 14 10:35:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13763307 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 11B85C52D7B for ; Wed, 14 Aug 2024 10:39:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=F1XB3SobLk7VZ//KTQh7GEC/+D2L+CRxij+/IGHYnPA=; b=KGypz4WnzflYl+Tfh7Ey2QvqDO 3F1v0ox8KJREPP54WF9L3pcpfuK3U6uzvdw9bxL+6IEsPD+WBpcrTjYODiV/0XKUkKNsNo4v9q5vT luO6R9ZqrKl+6Fx6Ta27bofeXX+novyWieQj1su6EqM+y8TvWooVNT7uB+FPYsjfRXGDypBi3Ydag dO5pDmxbdqas8l/EpDOKT3l5rEPM4GFpLBI/Ba8CeE5XAER3grG+AEjrWNQfXbfO8YSZJhYY3sCeU 1KHCKPrw3vUkXNODg7DHg7cyIAudZu9Tn7t4bj6wgl6rHvoJf2+yqqdAk0Cx5YG1x1The71XBBEnU dIC4/3Gg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBPm-00000006dw1-3Ucq; Wed, 14 Aug 2024 10:39:38 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBMN-00000006cs8-07fP for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 10:36:08 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-428243f928cso44984215e9.3 for ; Wed, 14 Aug 2024 03:36:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723631765; x=1724236565; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=F1XB3SobLk7VZ//KTQh7GEC/+D2L+CRxij+/IGHYnPA=; b=PElgpAXEF85BARA1jpHeX3pVdT5HpDerT+MmJabZUXZFd8uBoc5iaOmZ+ouVdkSTHP s2RHAz5aZt2XNEg/TayPmrWvxqVht4j+ZyBd2Vdpl0Hoyb47IHB1UQIHa+wQzKBxqFV8 m6A4kg+6DpHbneHXec8VC783vdPfb+rJpwtA503EumHtXGa7xnUq+35VvjAQJMkdRaOE qHIUP48golEvST4rcz7UPLlQDc8kWNfXF2/t/+5q4fCoMmsPXml5irldzbjp+x0xTIZH TZ/s24YaXqVHuf2cLuQTVR42JNOcROjTUCn/nTrg9b8W4VCJlEN+SDlo7ETU0N7zP2no Q3hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723631765; x=1724236565; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F1XB3SobLk7VZ//KTQh7GEC/+D2L+CRxij+/IGHYnPA=; b=tz32df/RoQSd7AzX5sJdYeoylR0ORQrJ4b6VROTd7pRYkFGdnDnuUUwWp5ER7QDXMB CtcGubDbKZyoKb3uHGHrDSvv3RjF35Uq8+y/Qh12e1ehaOYAqfGfdYvPvvJme/gn9q0w gc90/8n6lCbOWvt82LpckAT9tgfm9kQ4tIMCp+uyD00HfPfxE/5fSqKwHx/tf989txKF 2BuCL2lyUXl/j/6Z1Y/V4qIKzdb0hvbCQAWcKKK5DfLRSxZLWwI4Dq2jKpIHq6sYy4aD nfDHUR4JkIkKYmhAZLr0QfDB7K/vCcM8qf4q/1z7LzRpyAm3J3ONVPpK23+E5ifdODvH Exlg== X-Gm-Message-State: AOJu0YxTFwodRd3gzDDil6369bS/ZiDyzaReTGVYdm2NZ4hiaoMNf2DX 24jXVEKId+USyCZkuyvltiL5DbJA1UaCrfEKa445dzT/L5cOR4R3StSatfXViJI= X-Google-Smtp-Source: AGHT+IHu+Ec7SMXK44CW15aI6wvbF/SSdZgsQigQTDfjf8g51hhj14oMtIh5VGN/FNCI7LDZHb/OkA== X-Received: by 2002:a05:600c:310b:b0:426:8ee5:5d24 with SMTP id 5b1f17b1804b1-429dd23ce9dmr18887445e9.20.1723631765087; Wed, 14 Aug 2024 03:36:05 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded3dd4dsm15501835e9.29.2024.08.14.03.36.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 03:36:04 -0700 (PDT) From: Krzysztof Kozlowski Date: Wed, 14 Aug 2024 12:35:41 +0200 Subject: [PATCH 05/11] usb: dwc3: imx8mp: simplify with dev_err_probe MIME-Version: 1.0 Message-Id: <20240814-b4-cleanup-h-of-node-put-usb-v1-5-95481b9682bc@linaro.org> References: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> In-Reply-To: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> To: Patrice Chotard , Thinh Nguyen , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Michal Simek Cc: linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1324; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=VJma9HGhkE1TDrQ1OhGJk9qHK29VLxq1nCdewcEacTo=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvIiDZ4bAv7tVf6yyVs5Q8BDE0c30I/4lsc928 qm+fK7AL+6JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZryIgwAKCRDBN2bmhouD 10D4D/oDgQvQBKScmFFH4ftXAiif3buhyX1tYwq/1dglDmk1dpS2Uom5hsUFuODAKTVkrgvS8I9 9ZBDxcK8lwLHgJsGEvv7wnENJ1ayzimyIU0FehRqrXwrvNKSkqVQUeJCECcCtIjs6mIbjSA49+n r+CKLXBd83EI5dLRl6jKhXrdyOSaZFAETUaHs2oZEf5vSG5js1KedY3wHxpRz/vbtkJaM5o1VK2 rP7MGvnPiaGhY6B7mEHEprCBBbNEPTqejUKyZUIwzg12xUfWw2x9RdMHURMyQrMJlrBiZIzlKGw bOW2gDzy2qWW9Q5/u/RBds4vyXhp47ojbXo11hHockv6+sHDUKg3wsMqQeDWC5uw8Vwo8VgPFZi N5BuVPl7VNp6CC0jCtVFpQqsumutnnByaPeMLryUa6ooemCfTAZ9OT/qIftpGHI3MCjKWsWgWP8 bKPy00IeGa7lFrjxYTtmDXmU27lo+tenGJyMdkO0NKuokFBi+4MgN9qo0cgmq8kQHNgGJAiTTXr A8qNtA04wUCvA7LBJYNyKQ1shog4fKrmVFGCZC8BdJNppG+sv0cNfDqAyq/idx6WHUL10VgRpRV +ax2dAU4fStY6PNV3LDjgL9lJjsoZC7ezHq+HxOJ+OHph0VyuqOSvKxXRxf3+Z+iyPpQRNCrm5W NR5sGcdIZ1Dozow== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240814_033607_099931_A5E7F70A X-CRM114-Status: GOOD ( 12.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use dev_err_probe() to make the error paths a bit simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Frank Li Acked-by: Thinh Nguyen --- drivers/usb/dwc3/dwc3-imx8mp.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c index 8c91e595d3b9..869b5e7c15ed 100644 --- a/drivers/usb/dwc3/dwc3-imx8mp.c +++ b/drivers/usb/dwc3/dwc3-imx8mp.c @@ -179,18 +179,14 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) } dwc3_imx->hsio_clk = devm_clk_get_enabled(dev, "hsio"); - if (IS_ERR(dwc3_imx->hsio_clk)) { - err = PTR_ERR(dwc3_imx->hsio_clk); - dev_err(dev, "Failed to get hsio clk, err=%d\n", err); - return err; - } + if (IS_ERR(dwc3_imx->hsio_clk)) + return dev_err_probe(dev, PTR_ERR(dwc3_imx->hsio_clk), + "Failed to get hsio clk\n"); dwc3_imx->suspend_clk = devm_clk_get_enabled(dev, "suspend"); - if (IS_ERR(dwc3_imx->suspend_clk)) { - err = PTR_ERR(dwc3_imx->suspend_clk); - dev_err(dev, "Failed to get suspend clk, err=%d\n", err); - return err; - } + if (IS_ERR(dwc3_imx->suspend_clk)) + return dev_err_probe(dev, PTR_ERR(dwc3_imx->suspend_clk), + "Failed to get suspend clk\n"); irq = platform_get_irq(pdev, 0); if (irq < 0) From patchwork Wed Aug 14 10:35:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13763308 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6EA99C52D7B for ; Wed, 14 Aug 2024 10:40:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=o0yZZkiVGAHvG3Uhgdq+Szhl2P4CMWl0ZOslSqiIH2k=; b=QMFPIy/K/wqJX25fyj9GpNau0/ xzkQ1qsHw8xfDabYDjmspIUJmpg1SLzDJ6635AmaDlFIu5tAGOJSzNwcHuVxgzLDd6DLsjvh8vpAj v/ujT5xglPc85E8B95d+R3bHWhMIP3USwhIYt6n+ulZA9+Zm/Cl9t/zu+Z+ipQjKVmfUzQzXJ2Y1/ QS0mB7vIUTiETzdGB6JAjML9NH+WCrJTJ1YlosbVGxgYncNeNmML1WLFCe236TPc2XNLaMearUDD0 meV69Lxw7zgkP8VJM/4k+5K0e/hJ7fDH18PAVvdJmzW3/EcqLUWZpZ8ae6e8QceDJE2Th/GDaDkag 2EqH3v2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBQN-00000006e8X-2JKI; Wed, 14 Aug 2024 10:40:15 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBMP-00000006csd-1Gau for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 10:36:10 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4281d812d3eso63569275e9.3 for ; Wed, 14 Aug 2024 03:36:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723631767; x=1724236567; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=o0yZZkiVGAHvG3Uhgdq+Szhl2P4CMWl0ZOslSqiIH2k=; b=g8A1Qu6yizyE0pmOxbJxH8mSvUB+3HqKZ598cvtufilcv7NEClfSdC7TLw2BAfbxNn Cc27eF0ksXIgVOWqVyRBEKzjTSKUrEEt1NAlFvrUiZDQ/L6hyrvinpAeRIH3/1fy6NCk Beun9EpOXFbrFZQVjrtg6cQ6JoEfUcb7IHyyKvdq69UqUoFdpWjprKGykO7yNUT3ZaA1 +M2xhDvFM+Syni+vGrOw/XTyE1zZ9qkCrXjvcOTsv3YKeXWKriHiG9qD6uKvI+8PrHnC ULSgp/Zt9/R9xxUgCSJP4VJ+Y9VmOiwUG6mQCTh5BxokcoDH9caG20sBQv2bOybkny2r bwuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723631767; x=1724236567; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o0yZZkiVGAHvG3Uhgdq+Szhl2P4CMWl0ZOslSqiIH2k=; b=mxY8DL4amXw8MhFJTT8ssbtajaEj5RYHXnjps6Z0fzUVJBWTtwdkwRWnVPmq/jSbUg EIQJejCKMGBVHo6egf1CNzYah6+IG3FcRDESK2cKjtq60sicKW5u+f8jz0Sd1bajj+dp OS3mJD1zb+lCkKN8AJzjR1YQ3jYX/pkUnsYfQssit0X1YHrkf1WgEKvYq9bXetdjdAs0 gWOIEtQIO0H/MlzwpNC7VKh1QLUS+metW4Teit2HOySW0VbvcsZFR7b5cyi5kCoyOuV0 MzSWB4KSGKtw3jV34BZKKnyaY6hCDmfcpavGLzEHFRVEG4aRAbKSZTTPMlc7EIfjfh32 2OHQ== X-Gm-Message-State: AOJu0Ywow1GCFVBFIHniC2RSrqUsgnGS7SqBc1rYJqSz2ZBC7kMVTbYl XVXLKAKuQ3v18nH5Hoe3/TSvdWpz0LV7plmrj7B7iqwWNvUr9/6Thtv3YEuOJv4= X-Google-Smtp-Source: AGHT+IECnrLkSvOLU967Ixqt58KlZw4LUJ2Sr4a2EN9+MC8iCPO7lC7hHWn2v/AOmllSOJgLdpmVeQ== X-Received: by 2002:a05:600c:4fd1:b0:428:111a:193 with SMTP id 5b1f17b1804b1-429dd267dbdmr18605055e9.37.1723631767485; Wed, 14 Aug 2024 03:36:07 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded3dd4dsm15501835e9.29.2024.08.14.03.36.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 03:36:06 -0700 (PDT) From: Krzysztof Kozlowski Date: Wed, 14 Aug 2024 12:35:42 +0200 Subject: [PATCH 06/11] usb: dwc3: imx8mp: use scoped device node handling to simplify error paths MIME-Version: 1.0 Message-Id: <20240814-b4-cleanup-h-of-node-put-usb-v1-6-95481b9682bc@linaro.org> References: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> In-Reply-To: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> To: Patrice Chotard , Thinh Nguyen , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Michal Simek Cc: linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2672; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=j0zfRj/X2/+6dKjlOQj6O9cChXLgLEzhiSFx4m6Tnsk=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvIiEp8GOG3zGFV68+340kx5cIizIXq1eu/fA/ Ae1uCmz4UyJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZryIhAAKCRDBN2bmhouD 1wlbD/4ivHNZDn9M9PDUIIvFYOW0r0W4Z0SKqhvcAaw/eUZ2z2fJ936yLfVTYB6pVOa9BMxwOhc OhhmaMvy51dJWYHcH0n1+QF7HmvWP7jyqwFsIDTyYMCyiqmRgFx/FOVZqXrggccxfRFogPsbPFN Bg+BN8NAscSo3kkLxXLbZXXc6LqQnfUytxgdC+kuVb1WA+LfjxvT9O8YJX8xDALIppTCrZgzGfl bg+uNPq5sEWtWOTL/bYX75okpi8oI/foj+LgQPKOmPNRYQ0pArhF/9jiz/sN+cMlPokYxdIv9Y2 2NVBNUjv18YjosVS0yWuQH6CCWvN90hLpDeO2ckhpqITROsvqHTvM/vneMKmNVW4b9WpAmx4XPw Y6J1BLGoG/434SflN40hhMbNEHuunX/DdCbXR4ieJK1DaaYsx26DjhuIPbUJovXwUSWH6znBGxv qudvdkFNlxukHrclvvQLQmjhzjcScDvAn+/k/hkOhQS1ZdrG28iXyzGQJyVhttcZQ0O0mAMW//X k3cEQHM3xAPfSiP9g/zkR5uYYRB2zga3sE4ywH0M8ISBGpKNPe67xhFkGElM++pOmOhYOskCjyF Fmwsq6iMzUDuIo+VgKRWRRrPgGx3BtRg2cYjboNf2TWag+DyRLkuYmfkUlZpsSjcY6CBK1wbIaM ryjCg1yAvxf6gvw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240814_033609_379628_14F5AD87 X-CRM114-Status: GOOD ( 16.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Obtain the device node reference with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Scoped/cleanup.h coding style expects variable declaration with initialization, so the of_get_compatible_child() call has to be moved earlier, before any goto jumps happen. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Frank Li Acked-by: Thinh Nguyen --- drivers/usb/dwc3/dwc3-imx8mp.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c index 869b5e7c15ed..8b88649b569f 100644 --- a/drivers/usb/dwc3/dwc3-imx8mp.c +++ b/drivers/usb/dwc3/dwc3-imx8mp.c @@ -5,6 +5,7 @@ * Copyright (c) 2020 NXP. */ +#include #include #include #include @@ -147,7 +148,7 @@ static irqreturn_t dwc3_imx8mp_interrupt(int irq, void *_dwc3_imx) static int dwc3_imx8mp_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *dwc3_np, *node = dev->of_node; + struct device_node *node = dev->of_node; struct dwc3_imx8mp *dwc3_imx; struct resource *res; int err, irq; @@ -193,6 +194,11 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) return irq; dwc3_imx->irq = irq; + struct device_node *dwc3_np __free(device_node) = of_get_compatible_child(node, + "snps,dwc3"); + if (!dwc3_np) + return dev_err_probe(dev, -ENODEV, "failed to find dwc3 core child\n"); + imx8mp_configure_glue(dwc3_imx); pm_runtime_set_active(dev); @@ -201,17 +207,10 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) if (err < 0) goto disable_rpm; - dwc3_np = of_get_compatible_child(node, "snps,dwc3"); - if (!dwc3_np) { - err = -ENODEV; - dev_err(dev, "failed to find dwc3 core child\n"); - goto disable_rpm; - } - err = of_platform_populate(node, NULL, NULL, dev); if (err) { dev_err(&pdev->dev, "failed to create dwc3 core\n"); - goto err_node_put; + goto disable_rpm; } dwc3_imx->dwc3 = of_find_device_by_node(dwc3_np); @@ -220,7 +219,6 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) err = -ENODEV; goto depopulate; } - of_node_put(dwc3_np); err = devm_request_threaded_irq(dev, irq, NULL, dwc3_imx8mp_interrupt, IRQF_ONESHOT, dev_name(dev), dwc3_imx); @@ -236,8 +234,6 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) depopulate: of_platform_depopulate(dev); -err_node_put: - of_node_put(dwc3_np); disable_rpm: pm_runtime_disable(dev); pm_runtime_put_noidle(dev); From patchwork Wed Aug 14 10:35:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13763309 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C903AC52D7B for ; Wed, 14 Aug 2024 10:41:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tdA2lN2q6veoMIbM5LLb1wXxxOsZ4MbHN1OFqGaeSQ8=; b=BFV4aOynlEXAQVt/E/oHSxcGpe 9s1P6AT9ZRcSqpElmTq39+8flsP0krxPgQ3AJKIbDsolZHbotE6vnrJSHT/IYsvePBx46EUJenXr2 LxCECHUo17Ff5Yl+MJMu83Ibo46/HdFmsbxKT4mHHQXNGeqL5MP7BpY6M4+EqRuCDGnn5ixpd32xO UwuGK4h4gFAWWiG1Vdi2i+QhhLODmwQ0+kZO9slEnfIEqk0MVaHn4vDRjYvbrgWWEmLKFRo5bVuMg 7Ey8kHKil5KUn4U6JM6HFTihpxDEF9VlPPQmrdQEaimO6HKosz0j/OFi3RtOEXoS6JpuziH/zpr8J yRr1ic2A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBQy-00000006eL7-1VKX; Wed, 14 Aug 2024 10:40:52 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBMR-00000006ctK-2cRM for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 10:36:13 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-428243f928cso44984675e9.3 for ; Wed, 14 Aug 2024 03:36:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723631769; x=1724236569; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=tdA2lN2q6veoMIbM5LLb1wXxxOsZ4MbHN1OFqGaeSQ8=; b=X3FkO3ggw/R39j+cAhtimo4mioMA6F3dP+jR3fP3FAT7HvD9aVVoyS0McPgQq/n/vH bD91cHmGq14/btNl6X9d9GzPwA7jFaizwvE0n8KQ8xbw6QfrIYUM533OGoFNmF8txrix +K7xqKgsPQqqp5s3VmwFhip+HJ3wYS0OwqGmgOxvwXX/q8sJBVrXbx26jZdvBO0LlUPK h2tRNFSw2krRPXvug6dz0o62G053VcBnfVheJ9Jg71PnvPAMofMqemOYZTjjxepcmTQ0 8pyEUKKwCSc9rv7oOniggu+vEHlKUjulKlzY/Uz9g+Tx56iz06Ki525AdXphVpFt5K9j 0HkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723631769; x=1724236569; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tdA2lN2q6veoMIbM5LLb1wXxxOsZ4MbHN1OFqGaeSQ8=; b=QE+ZLDBFoycXybHsNOKar2tv0rcYk4uH0IT7nGwA1t5lm1CsiEF7VlpXuHbH+vVwMa TZtJAIotIzqiGkGbGhoAziFuAStJ/SUCzfbxtagIv4Ya/hJth+/ThUIKcj6ZV9hxQqiP T10kcd29H0h4F4SmM5HQ6bCTy6ksYI2fDqIGur4ccaU64YMitJa2vYL2VhBK90s5Mw2p Ehrqywj+iwM9nKBkJDbOORv4em8kV9g7j47wlI2ePqu0AV3qC34SgZTlgx+UwYKN3LTn VVUxr5nAjU2LrLSZ9AUr0u6poLA6+Vjarv88c6vxyHn3mIQtDFnZhsRW6P9698KYgnrT ZlfA== X-Gm-Message-State: AOJu0YzRAoDjSW5yqlT0kyfGJnwejKGD++QWZ9HrZbWz6zNIf6C0izPA /WMDtPQamfJVcn87SdRNT+cf0NqmxI+P3Ab/hGbDO66CQhAk++Igwu6b1VBpBg4= X-Google-Smtp-Source: AGHT+IFE7qRnDKvcYh/oUsXuqZL/PoY1UtTYsAQZ/ZIKOt+fK4aWCLBS7UFZjbC1sOwdQ9LTP2J2gw== X-Received: by 2002:a05:600c:450a:b0:426:62a0:eb6b with SMTP id 5b1f17b1804b1-429dd2364e9mr20506945e9.13.1723631769418; Wed, 14 Aug 2024 03:36:09 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded3dd4dsm15501835e9.29.2024.08.14.03.36.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 03:36:08 -0700 (PDT) From: Krzysztof Kozlowski Date: Wed, 14 Aug 2024 12:35:43 +0200 Subject: [PATCH 07/11] usb: dwc3: qcom: use scoped device node handling to simplify error paths MIME-Version: 1.0 Message-Id: <20240814-b4-cleanup-h-of-node-put-usb-v1-7-95481b9682bc@linaro.org> References: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> In-Reply-To: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> To: Patrice Chotard , Thinh Nguyen , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Michal Simek Cc: linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1789; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=cvPFMMR9o434sytT/dR1qucAAqA0mR0xlD7ZHF+DVrs=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvIiFOSGYZ3MyWgBlmp4elS2FxVZLfoOlKKVXf nEc7sNj/76JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZryIhQAKCRDBN2bmhouD 12HdD/0SbhZgsdPxESEXiWrmD2MmSlZYaHIFK04QnmtTGzG7t0Jh9HWfChuRvbauueqiX+o/xmb 1xkdBCsIc82mGS/7fxIw7wVpbHa7v1f9VHg4JI015V6ZIXRjyn1XB10nbWe8VVRC1mgwmyG7jth kS5I5vmPYOjF0aOtGMcRiRm+1S2jGaY/gKkY+A7n0/SmuIODqDGlYeL/923e4abPDAwVOKvtrrD AIHf3MWiqqurK+VEKKKsumGSousFEwSvqNnyZd31PsWq+a1bsnJjlJMCNCJQAnVeGzfaMqOloRK o5uxNYmc7M319TY3v2/4NO0NgBBgqt8qD2gYIwXE/w4Su9w9vJ9RAFcsARvZ0aznTWdHfOvbD6T OOD48G5lh3b6UYDC4+tMcKkGZxVabxXS4REYNSfgNJNTTZ2Q3odosHwb+Y2dUzvjb+uk54Er/Q+ 3Q8hCccVDKI6cy4edmZqEeYtjGolF+krVLeSsHLWo2U6fjRi6IP2DbAYjTKwhPYoxEQBCyFIeIO G4hLCP9N6ofmZJ4jjLssM25rSsHQpYICn06Wcu56RK4E1EA3ro4j06nqmKErn0sKnFCaoFD9Lk4 CLBigpsWJC2CT/8OdwgPOptlM/IYzBsEntE1q+WQPA66K6AMI8NUjL9w0I4H1bS0Sfl9siH2n9m eMa8s7NeLt86+RA== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240814_033611_705758_0C34D1F1 X-CRM114-Status: GOOD ( 14.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Acked-by: Thinh Nguyen --- drivers/usb/dwc3/dwc3-qcom.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index 88fb6706a18d..03a8f080078e 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -4,6 +4,7 @@ * Inspired by dwc3-of-simple.c */ +#include #include #include #include @@ -702,11 +703,12 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count) static int dwc3_qcom_of_register_core(struct platform_device *pdev) { struct dwc3_qcom *qcom = platform_get_drvdata(pdev); - struct device_node *np = pdev->dev.of_node, *dwc3_np; + struct device_node *np = pdev->dev.of_node; struct device *dev = &pdev->dev; int ret; - dwc3_np = of_get_compatible_child(np, "snps,dwc3"); + struct device_node *dwc3_np __free(device_node) = of_get_compatible_child(np, + "snps,dwc3"); if (!dwc3_np) { dev_err(dev, "failed to find dwc3 core child\n"); return -ENODEV; @@ -715,7 +717,7 @@ static int dwc3_qcom_of_register_core(struct platform_device *pdev) ret = of_platform_populate(np, NULL, NULL, dev); if (ret) { dev_err(dev, "failed to register dwc3 core - %d\n", ret); - goto node_put; + return ret; } qcom->dwc3 = of_find_device_by_node(dwc3_np); @@ -725,9 +727,6 @@ static int dwc3_qcom_of_register_core(struct platform_device *pdev) of_platform_depopulate(dev); } -node_put: - of_node_put(dwc3_np); - return ret; } From patchwork Wed Aug 14 10:35:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13763310 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 80BA1C3DA4A for ; Wed, 14 Aug 2024 10:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jmBhmMFWi1AK4p52cV4BVjQgGxMNMRXnfeGS+WqO0BI=; b=y6Eq8NrrqN6VHztfXgpSmSVDXr rJFYBYjUkNT3xdcHkZFflkVwBCiZFHIY32IJ7BNt0yMagEfLJkJ1RfcvPK4cPSWujW3/33a64vtZM kYHhLv9tlhCfh3b7VASKXfzSwtAlzIlNfkP+C3xC+EsXO0+POJ+60ROOnoyLpqxYxxtvOMsqN92/x alUfolBUbDpGr3KFcUaRfu+ECRQl7jJq/eIvX7adrG+u5P3uuNjeg62l7lco3TVBa/Miful7VVMq3 Bt0d2N5El+jnp+888u5T59PneHOeauIwngwGBBfBR4WoSN2bjHgqsUhK4Q68FHSUgCB7yRr1lXryq Aj3KvSXg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBRb-00000006eZZ-0snU; Wed, 14 Aug 2024 10:41:31 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBMS-00000006cuY-2jAv for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 10:36:14 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-42803bbf842so63676235e9.1 for ; Wed, 14 Aug 2024 03:36:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723631771; x=1724236571; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=jmBhmMFWi1AK4p52cV4BVjQgGxMNMRXnfeGS+WqO0BI=; b=pY022cPYEbLKHLDVA5j9xtjUjtMlUhOTR9856YDH8Tgqoi+eVTrQQHjLHCqGbnpo1P dvrOq25Ej6k5/+v1jUmtDOEZ+On/hYvUSWP+5NNzUYTQ5prLhTtrE29VQ+DZI3uovGyg gbFpLybfWl+SzC+nEYWXfT8IHfxI4gjKW8HNMVWYQnHW9CLbNOtzbFq4z7cLCyqOgJp6 QNvGwddDjwlQ+faH7C3oJvKvvy7Kfy6eu2fdZr6BWG+RehSlGYsHd4wXWxLF2TGPsgTT lqxPUz+E7/PbNGljlQ4zAa9Q33nV+q6TDTs5n5R50hHYugwhhA/ivXsshn8muvConeWn fF0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723631771; x=1724236571; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jmBhmMFWi1AK4p52cV4BVjQgGxMNMRXnfeGS+WqO0BI=; b=DUo3Zjr6JJbnHQHbD1wTYSOAzc+yuBbXxQDwE/gO8kO0F7RpWbei5TAzJFQpKFV0B0 95Ciwd41LOfZZRPlB4kMFC+gi5Hic+KAss4optxSUmuoUp8tTS4QxBtdU4P2yqo/SLuJ 2blxODZk6pfkl8Yf2lkOEtPWi97JGd5uRljVL8C004ZebiiM2Yb16QIZIiQQnGMgNa2r N09RlWoAj0hl+rzd4a0Sy5IyU8NbPIIXxZdvBswu1KBbW2/0JaIN9Opoo0no6MlOju+u dccARQ4mR7z5E0FCykOgmEN7VLYO3MBqBE0rh8Z1dLibRosTe4evy4csgt0CsxQ09vN+ /s0w== X-Gm-Message-State: AOJu0YygJQaI0OP7hc/DQ0SB2+WBxAonm4Q2OLX442iGynprvw07GJC2 ofz+acZGvjKmh7nvMkbWYWy1B1ZqMT/5F4iG4lc+JbUkW4Tdfe+yvIrOlOmlhc0= X-Google-Smtp-Source: AGHT+IHogHV6eV4RqteTVOs3Qb1UfpP1jzjdAVvS0baMy3wCgVxuJ7NXLTXDYUfBCeeAh9lh4GZipQ== X-Received: by 2002:a05:600c:4588:b0:426:6857:3156 with SMTP id 5b1f17b1804b1-429dd25f703mr21588475e9.27.1723631771253; Wed, 14 Aug 2024 03:36:11 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded3dd4dsm15501835e9.29.2024.08.14.03.36.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 03:36:10 -0700 (PDT) From: Krzysztof Kozlowski Date: Wed, 14 Aug 2024 12:35:44 +0200 Subject: [PATCH 08/11] usb: dwc3: qcom: simplify with devm_platform_ioremap_resource MIME-Version: 1.0 Message-Id: <20240814-b4-cleanup-h-of-node-put-usb-v1-8-95481b9682bc@linaro.org> References: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> In-Reply-To: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> To: Patrice Chotard , Thinh Nguyen , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Michal Simek Cc: linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1165; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=9nfeEKWWXK71lyt3E4atHiwSSVqqIMbCjN5ufCKLQuQ=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvIiGfD4TwRONkGpsojmFbdJcSxCiCAlJTVmsp KTv9CRBwZ+JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZryIhgAKCRDBN2bmhouD 181AD/4lWRuDxBwo2xHM5NlbKzYfoEBMH+TJwD1iZQQQN2t2LkSmIj9sIhJf9aUuO2SWqiS8N1/ JZMIpmiRSmYlx/Hedr/t5KA2t3EfnF2j1LDxCXXBTmOC/ofE40HAg3uX0gq4M7xauGNagy+3anP trYHS1fuhm1DvmAvkQbKugDjFzjY7p76NpoT+xkk1vU8j5Lq46zv00diuCL7O+TdQ4wiy7+l2d+ +uZx/2z4yNWasYn8RecqsSVnZ+PPV12SlVp3zP8PqGoKzKIriw/CeVmiKITRfikqPbBfa54yBj8 ObbF2WipNF/9cuHL3760xAbK8yqwO4LKq09FBl7QoIrrElGcjqDLNH+HT97w+efH7lHzrpZr7tU Z4aKEFT/IjwHW4GOgn43l77NZLC6kBHdux9fxme01si6NvNNQZRxoiwfye08skne95AfYERVKgI 000GDxr91kkr4Ro9cbdLY0QbRfCnYHq/Tu/OoxS7PuuFm0ZlOhqYXzxJEOmpUOsv0cTaunYFBwI tPXXcipxhrN10OGd/Bjk+ET9XRnGpfqRi9n15NzDgRojb1ru9sIHnx/QKot4ij/XRl3xLX3rztp 2lKSTt5Sb46k9Ovq3XkiJdpjWiHA25ZUIZnH3in4yJyyKtmgBhB0QKpRn0TuV72QV2jik9P5RUb /TOUUf/yZvxkx1g== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240814_033612_727439_C71229A8 X-CRM114-Status: GOOD ( 12.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use devm_platform_ioremap_resource() wrapper instead of two calls. This allows also dropping local 'res' variable. Signed-off-by: Krzysztof Kozlowski Acked-by: Thinh Nguyen --- drivers/usb/dwc3/dwc3-qcom.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index 03a8f080078e..c1d4b52f25b0 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -735,7 +735,6 @@ static int dwc3_qcom_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct device *dev = &pdev->dev; struct dwc3_qcom *qcom; - struct resource *res; int ret, i; bool ignore_pipe_clk; bool wakeup_source; @@ -773,9 +772,7 @@ static int dwc3_qcom_probe(struct platform_device *pdev) goto reset_assert; } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - - qcom->qscratch_base = devm_ioremap_resource(dev, res); + qcom->qscratch_base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(qcom->qscratch_base)) { ret = PTR_ERR(qcom->qscratch_base); goto clk_disable; From patchwork Wed Aug 14 10:35:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13763332 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 39139C52D7B for ; Wed, 14 Aug 2024 10:42:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HjbppopIL/o3EmGP4sE2p5zF2oRRpxGK4rh7C3MD61A=; b=ot22rpAtrh5E/9AFFQZN9FUNLf ZBsWSRHtsaS38xYkcfHB3Wep5BHmEP7VZaqmvcKgcg9uWBw0wttPtd6k2T9JTmpgeP08UA+m3N+9h S24RkXgQNms57fblt3PfdAFG4IHWRkvfs3QtFS8v8lA3glEXEL8zXC6z1U5+QnTlKnnVJSVij15z0 LIY81eAtkEJSvWw0fOu32gpCvOVh+vgv3F5PM0uViXdtNDuybsAnxmqx2/y+V8TQcdlaLf7AeaZR0 iKut58RRBUUJFPvLTBv9kvtZyv8NWaRE4Qoe6G7iYwmIvMntTWN5qOtCZ6LDIoRQaJ0aw4uKqlj7w EWUwgIMg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBSB-00000006egN-3rDu; Wed, 14 Aug 2024 10:42:07 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBMU-00000006cvL-14tv for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 10:36:15 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-427fc97a88cso49523515e9.0 for ; Wed, 14 Aug 2024 03:36:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723631773; x=1724236573; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=HjbppopIL/o3EmGP4sE2p5zF2oRRpxGK4rh7C3MD61A=; b=WYA1ECQcLiAdDCjL+oFWdEptgCxPEetryarBQIhZ5X+/whjQ3c1L/smTcFx4JkNsEA PFadeV4hrSDHjXbT6ErIk70rigximwFkYu23ysjAvV1cPXmT2CuZfbeTWfWK53YSFWVe 7i+GH4Zc6d0ZYV3LNZpQhNKW6hVE8HTXQr4FsxWbTWR/WFPi+b+CFNpJx8L6/hj7W55G KPnYE0lGxbwEG6MCmcaCF/PE91M55zf72fbeZW1w2SVLXB5DooskCNmp/fAGjleupdLu BXlIlU1dUkOKVaumD7o7JL/pEc4uPoR07mOcMEgY8Q4JqEFLkT50LSwKt5+DzTceTOl7 PtYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723631773; x=1724236573; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HjbppopIL/o3EmGP4sE2p5zF2oRRpxGK4rh7C3MD61A=; b=TP9A8DI8GaN5Pc9bN9X7bNnGvym6YyVAnVepLalnTrL/8+FVKJhpXVByT3nbfB74NN lGVEYD2eROV0GrlXoi0v0AYNRFrDKFRFTXgb08gdkMU/TaJXSZZuAZaUYlPY8IV0J5aI g9fTtQQ/p17ahieDfNtwPv2LpYjxgP7X8CSZo95jOIIKjAfTP1YG3vE57QYI2if/V0q1 vkaw87+VMXLQFWLtEr5JReT3kD8+75ZqNmWcbrbxCqknjmfFCGouvnAwa3vE+wgqSXBt EOA18/n4FmB5BMOqQhrqVReIWFMZNtaM1OqShbPQMxFIYecarssvpsZ8crv28OIu6TNR sSqQ== X-Gm-Message-State: AOJu0YzIUMDsI2eov5HjvJtcTAh/jkBGBN9nGdV8wXw8GbTvINnpzTmn T4y0aZNSTYUmvIulmOzx0W79kdVqL3H0azDIE96IwtP6SHKbm2ekUjjg8XtgYuc= X-Google-Smtp-Source: AGHT+IGqOC4P6LuGVYDCd0LGQ8yL+BZNLTycWYBXifIzEcMIwJ4l2eW9+kjhsDRezNFecC2G2PBsOg== X-Received: by 2002:a05:600c:500c:b0:428:6f4:57ff with SMTP id 5b1f17b1804b1-429dd26702fmr14846075e9.35.1723631772912; Wed, 14 Aug 2024 03:36:12 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded3dd4dsm15501835e9.29.2024.08.14.03.36.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 03:36:12 -0700 (PDT) From: Krzysztof Kozlowski Date: Wed, 14 Aug 2024 12:35:45 +0200 Subject: [PATCH 09/11] usb: dwc3: rtk: use scoped device node handling to simplify error paths MIME-Version: 1.0 Message-Id: <20240814-b4-cleanup-h-of-node-put-usb-v1-9-95481b9682bc@linaro.org> References: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> In-Reply-To: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> To: Patrice Chotard , Thinh Nguyen , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Michal Simek Cc: linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2643; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=VJH7ww0yEa5hwteKt4Iy0cvARyKEeaAwJ+DzHXrHZjQ=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvIiHDUE1X6S3IWAv34HXtuIqBmv1I17GruhtF vPMWowVMvuJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZryIhwAKCRDBN2bmhouD 1xX3EACUB9tf6k7X0MULQJXFJ+ZLByLYVhL7ksURJsGivZ2/rG8khKJhe+lNIOn++WlU7XJ6e/e 8/qeTs/LZWS5ZgzVK1vHRD5noK1fQMkTLERlQpN9puEVzFAlrOp00EoynceA9fR9741SS6kqQhw QrrJ89/ko3JPlrJ3Dz+RAYz9D77pCEA3VCW7R6yLm6PRwQd75jVNC8Lvw+5JGCRNweIoClFZN0H 4+mcDdT5nmdvghsSAaefcdJZ2XXqiqWFFiiLBxRg7aLVnrdycDIfNIg7NLldPPEH3v8z3ES8m9d bN4sbyYuiR37k+qLrRorIyuKEMRwawAOxehbBfLrEw32eLQ5Oaz5XTlCkOsVel6ibAEO+nb7VKX IwTeclzbW8iQfd96NyIWUCsFcluH4fpk8GJ+iUwqjD3dUQWFUCB/4GoygBqH+VgqtWhwREQg27v UIL/XZf+6dc5dsHcb3NqrgIxdmCwRk8N3P3RG2aiiiMT7XKF8xVVdVTsXtWp2OM/RJuw8YnXwaf 7NCtPLKtmR6IcVhsLuvFszR/5E8PFz5HI7OFHLwqz1BvPJZ+CQreQwvoiiUjHOy83Lalcmi/uHq 911FcqaYwh5nkFNMDbJlgW3jlN/j/q62/fb6nuknwCxuYfI7rcZ4kjxp07zimDhiZ7BZMCma95D HG9w8MKbFx+0k4g== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240814_033614_353630_FDFC2902 X-CRM114-Status: GOOD ( 13.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Acked-by: Thinh Nguyen --- drivers/usb/dwc3/dwc3-rtk.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-rtk.c b/drivers/usb/dwc3/dwc3-rtk.c index 3cd6b184551c..1e3ec2084286 100644 --- a/drivers/usb/dwc3/dwc3-rtk.c +++ b/drivers/usb/dwc3/dwc3-rtk.c @@ -6,6 +6,7 @@ * */ +#include #include #include #include @@ -173,23 +174,20 @@ static const char *const speed_names[] = { static enum usb_device_speed __get_dwc3_maximum_speed(struct device_node *np) { - struct device_node *dwc3_np; const char *maximum_speed; int ret; - dwc3_np = of_get_compatible_child(np, "snps,dwc3"); + struct device_node *dwc3_np __free(device_node) = of_get_compatible_child(np, + "snps,dwc3"); if (!dwc3_np) return USB_SPEED_UNKNOWN; ret = of_property_read_string(dwc3_np, "maximum-speed", &maximum_speed); if (ret < 0) - goto out; + return ret; ret = match_string(speed_names, ARRAY_SIZE(speed_names), maximum_speed); -out: - of_node_put(dwc3_np); - return (ret < 0) ? USB_SPEED_UNKNOWN : ret; } @@ -276,7 +274,6 @@ static int dwc3_rtk_probe_dwc3_core(struct dwc3_rtk *rtk) struct device_node *node = dev->of_node; struct platform_device *dwc3_pdev; struct device *dwc3_dev; - struct device_node *dwc3_node; enum usb_dr_mode dr_mode; int ret = 0; @@ -290,7 +287,8 @@ static int dwc3_rtk_probe_dwc3_core(struct dwc3_rtk *rtk) return ret; } - dwc3_node = of_get_compatible_child(node, "snps,dwc3"); + struct device_node *dwc3_node __free(device_node) = of_get_compatible_child(node, + "snps,dwc3"); if (!dwc3_node) { dev_err(dev, "failed to find dwc3 core node\n"); ret = -ENODEV; @@ -301,7 +299,7 @@ static int dwc3_rtk_probe_dwc3_core(struct dwc3_rtk *rtk) if (!dwc3_pdev) { dev_err(dev, "failed to find dwc3 core platform_device\n"); ret = -ENODEV; - goto err_node_put; + goto depopulate; } dwc3_dev = &dwc3_pdev->dev; @@ -343,14 +341,11 @@ static int dwc3_rtk_probe_dwc3_core(struct dwc3_rtk *rtk) switch_usb2_role(rtk, rtk->cur_role); platform_device_put(dwc3_pdev); - of_node_put(dwc3_node); return 0; err_pdev_put: platform_device_put(dwc3_pdev); -err_node_put: - of_node_put(dwc3_node); depopulate: of_platform_depopulate(dev); From patchwork Wed Aug 14 10:35:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13763333 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AC9D9C3DA4A for ; Wed, 14 Aug 2024 10:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jOU0Gq3KpoO7WBWTzWhfXxGaOW7blDKSHePxJmszLkU=; b=nGRsCw0JPc2g32xkiC1B55xDA0 r6oyb+xg7gyXqnNlQbmG8/Wx4nhXQVrr+swbCbGu2Jt4Qdi+ihbFZeZYXLqbN2D+j4hcEm+o3DnRZ Rkdt5BT2meVLAxbZmwARHGK23ONtm165R5LPApxw1AaYCSU50zaCOkuDhYo/Cl/WCiiBGZJXin1r0 1HzImvibbbSC6qQc3It450sYQJmP1nt/b+t4Y88kAsQzKtO54FBhCpjWLKu+qq7bVRqehEkgl8uVz pdAHJumPMOHvv65CPJ6/9AE6qWfr6NZ1bVRlRQV4LTGs+GjxJ6YuRwteQo4bUmYMI30BEcFfW2m98 8M8nCTMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBSm-00000006erg-3DZc; Wed, 14 Aug 2024 10:42:44 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBMW-00000006cwq-482P for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 10:36:18 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-428f5c0833bso4164465e9.0 for ; Wed, 14 Aug 2024 03:36:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723631776; x=1724236576; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=jOU0Gq3KpoO7WBWTzWhfXxGaOW7blDKSHePxJmszLkU=; b=B4G98uLfRoIjQVrBcnOtikBiKwnGhgwmbejOhqjdo30CvOytbZKcwU3e65n/d7tzav tT2f6/Y2UlXT5I94/aLtjaEijKBVjaqk+tE1YDO1VOyjxp6MhNJb6TYDXl6/ymtDY+P3 8czWUy6wPa5q1AxZwa/702jAWIsIRccivS4keUomc1jWZcTg2NRRR8Po7d28DYBTj1P3 DTeqIfcfOEKfVWUI2J/3PCPE8iVsOkDLZR9VO2QQ4Ih9xnTGoKmdln7oraO45o4lHcsK Y0wddHLBcMElTPUJF/JyodPHK50Sy1S+xYjQgZ9HfP4SKOswCzAe4CiBfpcjzCGZpnqF oQyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723631776; x=1724236576; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jOU0Gq3KpoO7WBWTzWhfXxGaOW7blDKSHePxJmszLkU=; b=qpzodAc3w3thEep5pj1JWKzDrDp+dAuW3ehfzVpuQsm/mpfVp4C3nqPGOfuxxpWRCr NGGUfti2OuM2bAsPVU5C6lPh2yy44+QrLfApmVOS7yVkOQwnQ0ThOSaNaAgwYqPG9L+p ++LbMW9+QzIGhvAJEaBrqeLr4rUeBTZ/jM1g2OJoaVDB/ZIEp0SS8egMp+utMPYnuyeE nCU0D3V1fcPwwiAMGzmnjGkfWSygk1ba/h4ROQtW6T+ymQ7le050cC26ar1vzruG7GG4 sraJB7q7EvkewBb4EgRIoADfsHVBFpO+j4v7U41hQ3Lp3SqDF0JiEeDoqy+zONHNtpgZ U75w== X-Gm-Message-State: AOJu0YztQQt5HalCUDjolW06fPoakogDSN/fVz2h5me+bogn22TKNH6P O70UM08J3QTeZ04JEFac7vUks/j9ROyKO7rP44MzZWUfBu8PdD/bjfGO+oQRb8M= X-Google-Smtp-Source: AGHT+IErg2dHX74n5TysQQr/gvq6r/w/Gz7PLsV5/06cgv2TpA9Ny7e7jZhd+HWMaeBO4jWCb6N20A== X-Received: by 2002:a5d:64ac:0:b0:36b:aa27:3f79 with SMTP id ffacd0b85a97d-3716e3ead20mr6020700f8f.4.1723631775573; Wed, 14 Aug 2024 03:36:15 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded3dd4dsm15501835e9.29.2024.08.14.03.36.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 03:36:14 -0700 (PDT) From: Krzysztof Kozlowski Date: Wed, 14 Aug 2024 12:35:46 +0200 Subject: [PATCH 10/11] usb: dwc3: rtk: return directly and simplify with devm_platform_ioremap_resource MIME-Version: 1.0 Message-Id: <20240814-b4-cleanup-h-of-node-put-usb-v1-10-95481b9682bc@linaro.org> References: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> In-Reply-To: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> To: Patrice Chotard , Thinh Nguyen , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Michal Simek Cc: linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1945; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=aHruM+v3S7F5SKLPASpNGwqsVSdoAILTTajaygaE0T0=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvIiHcSmRGhuwBz9e8Zrie3GMyf3A0DgnlB9Ci 3oVAGm9VeuJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZryIhwAKCRDBN2bmhouD 1z/CD/9uYBrkwDpgMI8jLZ53spioe7hi+WbHBN32G8REKLdl035c6yyTkROruKhRMuCf/nB2BAw zDvWRJ/BidEMKr/0ERGyF8qpLSINWEJ6XQgKy8w+RCOa9qE5OyTkLrLVOrSVJZP6WDHYGmL5rDe Usk6jYBh0+KlqjawNYoC0DIjOZfY+rsbdqZr5xvRebfaFdRoPgqPADVkQurdUOwEu5maxtIZBaL AkEFUDGk0Tx+hzMJJsNFWyR3lAlbpb2Ik5T8rFUOKT7SZZgO8JdVR9WekyC0gv2PBIenJaU2bjI XFas8y71W1ldpMyNl3HldhhsBDC4SgFTokUml3IipSwBW2mIO+2B9qTD5W1ovj2VdrgWOlIqa/s A4J5Wln/Uc3DyYqeJylDOowhl0xVA+KRAgfMrxZ5qw9hh50sIOUCXieTuDwmcSMd28VNNmwrbhU 6/DH0lnscNlTUz3gWML/YMgxhXxP6P0GWDeJ5MKFUvvO9Irv4N9Oo+2o4G9BWUMtjXj/8C+uw/a 27m8GCF0qcOU1cibcw0sRBO7Apn2SRgjwc2tJz29AQH3xQb/g1PI7VraLR257qoqiEJmOtbHpnN E3ylOe98tUFbr3sYRnkOwxrOsI8nA9Is3o8leV1km53qyqmJWauSw1Vi2x7e6lniix+sXjtt0K5 K9IRO1+qoV4HcgQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240814_033617_116821_43820B92 X-CRM114-Status: GOOD ( 14.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use devm_platform_ioremap_resource() wrapper instead of two calls, which together with returning directly instead of useless goto, allows to nicely simplify the probe() function. Signed-off-by: Krzysztof Kozlowski Acked-by: Thinh Nguyen --- drivers/usb/dwc3/dwc3-rtk.c | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-rtk.c b/drivers/usb/dwc3/dwc3-rtk.c index 1e3ec2084286..b3db5cd9906e 100644 --- a/drivers/usb/dwc3/dwc3-rtk.c +++ b/drivers/usb/dwc3/dwc3-rtk.c @@ -358,30 +358,18 @@ static int dwc3_rtk_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct resource *res; void __iomem *regs; - int ret = 0; rtk = devm_kzalloc(dev, sizeof(*rtk), GFP_KERNEL); - if (!rtk) { - ret = -ENOMEM; - goto out; - } + if (!rtk) + return -ENOMEM; platform_set_drvdata(pdev, rtk); rtk->dev = dev; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev, "missing memory resource\n"); - ret = -ENODEV; - goto out; - } - - regs = devm_ioremap_resource(dev, res); - if (IS_ERR(regs)) { - ret = PTR_ERR(regs); - goto out; - } + regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(regs)) + return PTR_ERR(regs); rtk->regs = regs; rtk->regs_size = resource_size(res); @@ -389,16 +377,11 @@ static int dwc3_rtk_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 1); if (res) { rtk->pm_base = devm_ioremap_resource(dev, res); - if (IS_ERR(rtk->pm_base)) { - ret = PTR_ERR(rtk->pm_base); - goto out; - } + if (IS_ERR(rtk->pm_base)) + return PTR_ERR(rtk->pm_base); } - ret = dwc3_rtk_probe_dwc3_core(rtk); - -out: - return ret; + return dwc3_rtk_probe_dwc3_core(rtk); } static void dwc3_rtk_remove(struct platform_device *pdev) From patchwork Wed Aug 14 10:35:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13763334 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BE260C3DA4A for ; Wed, 14 Aug 2024 10:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SCsVD5Gw0XMLJtG9b25d0pMLRHt/Ggpq8ks2EPhWn3E=; b=3MCoW3dpVd/iVSAcL2MnhllICB POkv2gIWt8+5T+7lH3N1d7/w/KDXpb9P5mPFb+BBNQhPNlgLvc2Eu91c6Tj4/K0W8B6C/1B3UbrTJ 1ifVRfCr4zdQ2S86uByhwkhAg1G9GoWiwZUhytzzC74j5mdrMNItIYzH8b5IhZ0/PswzzRYeyUzK4 c/YtTF8m4YIALc2dAwa5+3sapnsgNvoeiN8RAZCyfBXDPoYnktwwVlADIDwgVIzKgTE6BXYQANuwD aioOTZcB8fAuPN4AKW14Minaq6KP23xYcATmiAYBFKyeDtIZhR7ghIDrmLHf2KRId+U3/raLmZfPv DCoWtO6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBTN-00000006f0t-0tZc; Wed, 14 Aug 2024 10:43:21 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seBMY-00000006cxX-3lVj for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 10:36:20 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4280b3a7efaso47832365e9.0 for ; Wed, 14 Aug 2024 03:36:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723631777; x=1724236577; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=SCsVD5Gw0XMLJtG9b25d0pMLRHt/Ggpq8ks2EPhWn3E=; b=KLtr/G8NIGvKpAEE+lixEhPlKzy06aZFoYgAi6MhxY0gcI5Ye0CBwEvwhxj2RbKExT 8nXQhz+R0VFKAmhm3KHY3r0As5DAtTm0lgbVHMj8h1VZVv0fMaL+4Y9JT1Yc29T0TK0E x/n1wRusNbahjNGyb1MkpntqJ6jmDjTSj3FHuG6PyIEvSt8NUR8rOflJ0pVHhMdnuONM u46wOA54h1S0rQAMhsejV7rorZfbiTnWuiXnoyQhge7Rpfy+dQyt6wA5zUvOXxa7ssuf ySXisxYKCg2B6fhXVzLYAA5SWzgmxq85MbM1Ea+tDK9nuN3sIc1IcWiA4Ve9f4nrLKV+ rW8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723631777; x=1724236577; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SCsVD5Gw0XMLJtG9b25d0pMLRHt/Ggpq8ks2EPhWn3E=; b=Wi+ga+0kgQr28TiWx1YBq3P6su9oXl73gCnso+YT9hfJAv75C2UnGFO51kqN21Qm43 TNNllA29NsJqNKZf4bJg2YiEMC/WgFBwpWx4t6xa0z3sh0WsVBItskfyeObtmYo8+Y9E J1UfqZ72kJ4l+Haz3s+WuqPTx/b/w4t/A3TuiI5SPcydIEjc/h0azGGLp4AIFMrQnW1K u4D8H7L9xec6aLkHXDeiWNmNLui1PnJjhuh5eUedQIJGFClj2AKenCbc88m5KeRz0Wmi PE0N1Mw8gSQZZ85NlHF9yltgMGyfa1nioTKNZCkvkBYjmSDk+hwMp4z2tngL41At6Eao 4q3Q== X-Gm-Message-State: AOJu0YyOXc4ijGEWdG8uLDGShR9GyLpV1ferYWYBtC7KW5cSGG+gsUTx r5EjN5Zq49i5uXfv4sEXSs79JLjrCWZWmxopAqXu4MUT4UMIbg0zjjbslD0BDA0= X-Google-Smtp-Source: AGHT+IGcxmywyTO2gvy35KOCttJ+ZJhhBQ2L4GtnK9UfIj5G8nLkgiKFU1tAu9Ts0iBIJ00/ObFPsA== X-Received: by 2002:a05:600c:1c93:b0:428:f1b4:3473 with SMTP id 5b1f17b1804b1-429dd25f517mr15394135e9.26.1723631777491; Wed, 14 Aug 2024 03:36:17 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded3dd4dsm15501835e9.29.2024.08.14.03.36.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 03:36:16 -0700 (PDT) From: Krzysztof Kozlowski Date: Wed, 14 Aug 2024 12:35:47 +0200 Subject: [PATCH 11/11] usb: dwc3: xilinx: simplify with dev_err_probe MIME-Version: 1.0 Message-Id: <20240814-b4-cleanup-h-of-node-put-usb-v1-11-95481b9682bc@linaro.org> References: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> In-Reply-To: <20240814-b4-cleanup-h-of-node-put-usb-v1-0-95481b9682bc@linaro.org> To: Patrice Chotard , Thinh Nguyen , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Michal Simek Cc: linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=890; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=ol6ZTXC6dPx1NNnToQYOXH4GwET4WoJKZEvGBAAyChA=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmvIiI0pC7cGWUcMPtTN5Rj4I9ue4DwVHlIBTOR FZKTmMNbuyJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZryIiAAKCRDBN2bmhouD 1/31D/4lelP2Ou1IyK4wZSB1Osrpv5THjLFKzvWenV3V5pHokmwuau5AJypaMbC2qkYkpr/mo1g WN0nuAtUFwUL57BPiqPpDYXrg9FDydmfDejUCaamjp+u6b6rJNrdNrP77XKpl27yBUP6koL22tH a6tGDDWdza5ocxOQu1Dkd44EM7uKDO6m9V7sUfhg1u8fZCL6wVLh/ZkYVSlSWB0/JEG4xOpDPvS mz5OYP4ExBLwy1UHPMjxsoWG6fo66yASdJ7oQJeBwrhLwxDiId88883oH7rgXiF7hlQJ/LDe5zp CrtGSn+DMV2F+41SmyuXRZgscfeVqGyxFMHVmSd5QqVFxNQVKkzBS6RKCPZNmQjSK7g2Mr65lFL jZMlm95cOlybp4FnequD5MWQr0616bw2DTxDKOTnJ9jVRQhM49dfkKoivW1YSxhXVzXXnjiIXGN v9Rz+OTnO/57SoVX5fOhI7z+C5FyYSyJA0mjZ5RqPVV3bjp5m/7SjWSzwckXidcwpGWswyahE1q tfLywc0KMgHHQLePAVq6LyQ98L48G+hcIo5X3KY0HeAeOnOTm8F4imWVj5ffkZ6FJzKu0V2Gi+l wwwYkgm/+wqTvNYRpLWfoUetlqZqSO8w0wLbAEUV5j/BFk6XqTnLhXiw6E0VI9viRD6fSFhT2Qr KEl4SJzQy/0HuFQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240814_033618_971904_E56DA61D X-CRM114-Status: GOOD ( 11.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use dev_err_probe() to make the error paths a bit simpler. Signed-off-by: Krzysztof Kozlowski Acked-by: Thinh Nguyen --- drivers/usb/dwc3/dwc3-xilinx.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c index b7613a106da6..eb535733ce91 100644 --- a/drivers/usb/dwc3/dwc3-xilinx.c +++ b/drivers/usb/dwc3/dwc3-xilinx.c @@ -285,11 +285,8 @@ static int dwc3_xlnx_probe(struct platform_device *pdev) return -ENOMEM; regs = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(regs)) { - ret = PTR_ERR(regs); - dev_err_probe(dev, ret, "failed to map registers\n"); - return ret; - } + if (IS_ERR(regs)) + return dev_err_probe(dev, PTR_ERR(regs), "failed to map registers\n"); match = of_match_node(dwc3_xlnx_of_match, pdev->dev.of_node);