From nobody Mon Apr 27 03:26:39 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE190C43334 for ; Fri, 17 Jun 2022 09:27:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380387AbiFQJ1D (ORCPT ); Fri, 17 Jun 2022 05:27:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380820AbiFQJ1A (ORCPT ); Fri, 17 Jun 2022 05:27:00 -0400 Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [IPv6:2a02:1800:110:4::f00:19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4569863BDC for ; Fri, 17 Jun 2022 02:26:59 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed30:100b:81f8:e79f:4643]) by laurent.telenet-ops.be with bizsmtp id k9Su270072Lt3zn019SunH; Fri, 17 Jun 2022 11:26:57 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1o28Fh-004P52-Ja; Fri, 17 Jun 2022 11:26:53 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1o28Fg-008ty3-UY; Fri, 17 Jun 2022 11:26:52 +0200 From: Geert Uytterhoeven To: Vignesh Raghavendra , Miquel Raynal , Richard Weinberger , Sergey Shtylyov Cc: Wolfram Sang , Lad Prabhakar , Biju Das , Krzysztof Kozlowski , linux-renesas-soc@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2] mtd: hyperbus: rpc-if: Fix RPM imbalance in probe error path Date: Fri, 17 Jun 2022 11:26:51 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If rpcif_hw_init() fails, Runtime PM is left enabled. Fixes: b04cc0d912eb80d3 ("memory: renesas-rpc-if: Add support for RZ/G2L") Signed-off-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang Reviewed-by: Lad Prabhakar Reviewed-by: Sergey Shtylyov --- v2: - Add Reviewed-by. --- drivers/mtd/hyperbus/rpc-if.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/hyperbus/rpc-if.c b/drivers/mtd/hyperbus/rpc-if.c index 6e08ec1d4f098c80..b70d259e48a7c728 100644 --- a/drivers/mtd/hyperbus/rpc-if.c +++ b/drivers/mtd/hyperbus/rpc-if.c @@ -134,7 +134,7 @@ static int rpcif_hb_probe(struct platform_device *pdev) =20 error =3D rpcif_hw_init(&hyperbus->rpc, true); if (error) - return error; + goto out_disable_rpm; =20 hyperbus->hbdev.map.size =3D hyperbus->rpc.size; hyperbus->hbdev.map.virt =3D hyperbus->rpc.dirmap; @@ -145,8 +145,12 @@ static int rpcif_hb_probe(struct platform_device *pdev) hyperbus->hbdev.np =3D of_get_next_child(pdev->dev.parent->of_node, NULL); error =3D hyperbus_register_device(&hyperbus->hbdev); if (error) - rpcif_disable_rpm(&hyperbus->rpc); + goto out_disable_rpm; + + return 0; =20 +out_disable_rpm: + rpcif_disable_rpm(&hyperbus->rpc); return error; } =20 --=20 2.25.1