Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp99889rdb; Wed, 29 Nov 2023 22:20:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IE1eXP92m3bu9BZhHgh/3H0JfZOF4Ib3b/SzJVgGXolHGUiTl08s5TDbtDv0paT98Smm/8i X-Received: by 2002:a17:902:ceca:b0:1cf:cda3:ecf4 with SMTP id d10-20020a170902ceca00b001cfcda3ecf4mr12445523plg.10.1701325257325; Wed, 29 Nov 2023 22:20:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701325257; cv=none; d=google.com; s=arc-20160816; b=a3l0Gv9KMBxrdCbXUHqyTY3aYBlbBjwancFEL4MyrC4+U/HmKeN7n8sTRs93VlmXCz It02HxfCXjqvYCrn3a8uOeemBlA8weyN0SD8grHjFRiWMASp68ouoiORXttAoBZCFSag Bqm34M5TuamUH3HLoPAxg+eHL9FeM0R1elO8xZImzd12p4BlcycSVOUgcmwqSa/sr1fx DwPPT51XZMUzOc1bBUZSJwA0cImK1NPRMjdYDutXS4cmdISBTT5r26GJeemX7WBlxZjG lXrA+9zUg4EfhtH921J4ZM3XGXiFaVjdj3SEGwghwRIKxJWOKnlpPfr+IcIMWIyVjOl8 b02w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TER/zjgFsQ4zH/M/nBtL41p2wpZGtg22rimu0p57AMs=; fh=0TmBxb3iK+HPjRlYDVXDLy5dPQUGD9gLiQry0et3j2E=; b=YaNmCK0/09J/CnfO51aeh7decj+TLffFm7t/bgB8bqwhBLwOXi2ELdrt/FpXmkaQyP kib50JA1gQjXXljKuzoquDOQUto5N76Q032RlwHXtHx/jxhmC7TIbh8i9aYu4SqlkS7E in7+v3CoAPzl6Eain66Q25H/NK1W537vqADsny8g1gOasZmbOxIZWht9/KWGzu5SB/+7 sQ6cdHS6p88avFqmizUcNY8otYZ/ZvR4+l6dFJxOWnuuADV7EK1AnsLKACHQ4zAJup5i x3DZ08p6MU6F0OEUsMBEQf6cnd/6MQ+9paA340ZrRJn/H3xcJSV5K0kU3yNKxPxh1k9u sOFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=NSH+yIqa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id v9-20020a170902b7c900b001cfd8c9c4e6si460820plz.601.2023.11.29.22.20.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 22:20:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=NSH+yIqa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5F2C5805F438; Tue, 28 Nov 2023 00:05:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343989AbjK1IEo (ORCPT + 99 others); Tue, 28 Nov 2023 03:04:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343955AbjK1IEj (ORCPT ); Tue, 28 Nov 2023 03:04:39 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE1DEDB for ; Tue, 28 Nov 2023 00:04:44 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40b4746ae51so12485395e9.2 for ; Tue, 28 Nov 2023 00:04:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1701158683; x=1701763483; 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=TER/zjgFsQ4zH/M/nBtL41p2wpZGtg22rimu0p57AMs=; b=NSH+yIqa5s/ZejJN07Qauf8d3WJ0IEOgE4+CpI5Ssa7gTjJgaJ8SKPO995OfuT9yiT ayBU6HqLc35b+YC1Pe9OicLyCOXwsySYl+EVIcsaYZ6H8AHJROjjcYxgh3eIBuAxQR5i WI+9CDTAi8vOPIX9u3K5rbkKyovh0twyjTiQdGLGRyP+trLsVOMDekoT7VazH0cra6Nk UgFzWAdzI7bN9m7wUyFNUQSbKFLze6KCd8/jzdTqd21+1eAzztQYyWaIQ0q+qqYKgLI6 UtjVproy8mrqO703i2QqpZmnOhBCmXFbFgMdf06JTPZSmO7asZqVGnAiunDC3+D7OvQD KHzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701158683; x=1701763483; 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=TER/zjgFsQ4zH/M/nBtL41p2wpZGtg22rimu0p57AMs=; b=p2IQS3ooY/IT9ULJS0gOu3tRVP824iLT9kD+luQRkrRcRR9HzSPAWiMbg1/ljaKUNn pc3miWTxcOZR8QY4i6JHwxSfc6C4kJeEJpn8qfz0Ikfy0so7gH7oRkbFlOGSGtx8m8pt cnvvz6i+ulqQGycWx+SUc6e+wUcJYbOEw9pufIxF6IsIP9AZRcNkq3BhH4uEGBO+4li8 VHBpAK2y6U2sEmCzeQAoRVTPvVtUuOTAAVyJHItidfWPOiGHW4B7Ab/IWlI72Kk4A6KJ YiX4xvLWlfeW7LoGsWZOECZ4++v+pa7EpRzbd4ElvPbF7ARWts4fIoOAHpYc0bmTAXIW MK8w== X-Gm-Message-State: AOJu0YxQP8GOoNqktwXnuaY67fTo9vJtnPUYB4kxlv+4MzKQy9LQZ1yG kEdfGeOXPyjCzqR5Hpas95DaxA== X-Received: by 2002:a05:600c:4f8a:b0:40b:4520:45a6 with SMTP id n10-20020a05600c4f8a00b0040b452045a6mr4460089wmq.8.1701158683147; Tue, 28 Nov 2023 00:04:43 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 00:04:42 -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 1/6] net: ravb: Check return value of reset_control_deassert() Date: Tue, 28 Nov 2023 10:04:34 +0200 Message-Id: <20231128080439.852467-2-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> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 28 Nov 2023 00:05:13 -0800 (PST) From: Claudiu Beznea reset_control_deassert() could return an error. Some devices cannot work if reset signal de-assert operation fails. To avoid this check the return code of reset_control_deassert() in ravb_probe() and take proper action. Along with it, the free_netdev() call from the error path was moved after reset_control_assert() on its own label (out_free_netdev) to free netdev in case reset_control_deassert() fails. Fixes: 0d13a1a464a0 ("ravb: Add reset support") Reviewed-by: Sergey Shtylyov Reviewed-by: Philipp Zabel Signed-off-by: Claudiu Beznea --- Changes in v2: - documented the addition of out_free_netdev goto label - collected Rb tags Changes since [1]: - added goto label for free_netdev() [1] https://lore.kernel.org/all/20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com/ drivers/net/ethernet/renesas/ravb_main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index c70cff80cc99..50c4c79be035 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2645,7 +2645,10 @@ static int ravb_probe(struct platform_device *pdev) ndev->features = info->net_features; ndev->hw_features = info->net_hw_features; - reset_control_deassert(rstc); + error = reset_control_deassert(rstc); + if (error) + goto out_free_netdev; + pm_runtime_enable(&pdev->dev); pm_runtime_get_sync(&pdev->dev); @@ -2872,11 +2875,11 @@ static int ravb_probe(struct platform_device *pdev) out_disable_refclk: clk_disable_unprepare(priv->refclk); out_release: - free_netdev(ndev); - pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev); reset_control_assert(rstc); +out_free_netdev: + free_netdev(ndev); return error; } -- 2.39.2