From patchwork Tue Nov 28 08:04:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu X-Patchwork-Id: 13470595 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="BhSlTlws" Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 584FE98 for ; Tue, 28 Nov 2023 00:04:46 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40b30308c67so38204255e9.0 for ; Tue, 28 Nov 2023 00:04:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1701158685; x=1701763485; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tex/f+v5XiThmeQ/1yf1Rnsid+DeltBdSjavRwGvUE0=; b=BhSlTlwsDX7EXSCG+VX6B79BvgoXHd3U8a/cpeGFbEjaV2osMCqUhL1pl4XF9LE0bQ iPwiKRrjO2grjbrzsg8VG4nqHOJRJGP8BDCO0SuLC0xuWcG/MGsCJrry6FTYGfFBFkQe rhCsCs8vcXl7YB+XR+OVZp8Nkz4hPDab+7zPn6DtAlpGmXmseDlEjry+8DyTE3Q0SRDF S01ZUwc8WvTwJsfEi6HLvdLa7IxdUoKiMm+gnW1DcEkdwk94w/vERWZyR/S8VCyshEvl UuKsydZip5vsibo/rNvTIu6QW2BxwpZd5MSQ4vy2tMxbcx4TDYCDdrLVv/+t7poAAXr/ bhdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701158685; x=1701763485; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tex/f+v5XiThmeQ/1yf1Rnsid+DeltBdSjavRwGvUE0=; b=PiRczplVG5RUMKBHrXjgp/4NbvtWMJ0KdAkiuZJK8qBuQqTSZBIITx3+6+0pgQNekL qRzu24RLs4hnLb/LVyiir3zDeRR8j3f/u2mvhfaQGnfiMv4A10wi3rPfXqFtNrkobzwr +D18+TBiH8Aa0XwGRskSI8BP5alSkFiCZ6AovWwvX/OcPuG55ysJ0LapEtsJ7k6rADW0 p0gluszT2/ZnXoUrlPS6qpD+gxxI0QJlzXHhPtSCSvqo4ggzbv8lZQV/ftLdUZuB1Ad6 kp+Vk1ZmL5qvDcyQKxP1KQ5t6MyYfyd1dNj+kFFW10fskA0wpjZITXePFnfQn1196Juf Mm7Q== X-Gm-Message-State: AOJu0YygXnAt7DreaZ+MT0JYDWKyJoCeZQ5J3GgZrpp24c9vR8Yycd1e 1eg5f5SQdfpN6KwuTgMeoowmbw== X-Google-Smtp-Source: AGHT+IFiDsJyWYZmV3dZR43yD6C7sj8hAw5H2KlFm+QwzJszuvuTxrXcIrJdx2qTTyted2pjAXexOQ== X-Received: by 2002:a05:600c:1381:b0:405:3455:e1a3 with SMTP id u1-20020a05600c138100b004053455e1a3mr9383229wmf.17.1701158684750; Tue, 28 Nov 2023 00:04:44 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.125]) by smtp.gmail.com with ESMTPSA id g18-20020a05600c4ed200b0040b4ccdcffbsm1127534wmq.2.2023.11.28.00.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 00:04:44 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, renesas@sang-engineering.com, robh@kernel.org, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, mitsuhiro.kimura.kc@renesas.com, masaru.nagai.vx@renesas.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/6] net: ravb: Use pm_runtime_resume_and_get() Date: Tue, 28 Nov 2023 10:04:35 +0200 Message-Id: <20231128080439.852467-3-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231128080439.852467-1-claudiu.beznea.uj@bp.renesas.com> References: <20231128080439.852467-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Claudiu Beznea pm_runtime_get_sync() may return an error. In case it returns with an error dev->power.usage_count needs to be decremented. pm_runtime_resume_and_get() takes care of this. Thus use it. Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper") Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- Changes in v2: - s/out_runtime_disable/out_rpm_disable - collected Rb tag Changes since [1]: - added goto label for pm_runtime_disable(); with this innecessary changes were removed [1] https://lore.kernel.org/all/20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com/ drivers/net/ethernet/renesas/ravb_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 50c4c79be035..0af2ace286be 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2650,7 +2650,9 @@ static int ravb_probe(struct platform_device *pdev) goto out_free_netdev; pm_runtime_enable(&pdev->dev); - pm_runtime_get_sync(&pdev->dev); + error = pm_runtime_resume_and_get(&pdev->dev); + if (error < 0) + goto out_rpm_disable; if (info->multi_irqs) { if (info->err_mgmt_irqs) @@ -2876,6 +2878,7 @@ static int ravb_probe(struct platform_device *pdev) clk_disable_unprepare(priv->refclk); out_release: pm_runtime_put(&pdev->dev); +out_rpm_disable: pm_runtime_disable(&pdev->dev); reset_control_assert(rstc); out_free_netdev: