Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp692750pxy; Wed, 21 Apr 2021 12:33:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3gCDgG7PDXPrGrB4RDVhC5UVO6B8hXd1zbirIbArksKt6P4JStuFlfN7M/nnaGgtR7EpT X-Received: by 2002:a17:907:3f22:: with SMTP id hq34mr33594692ejc.535.1619033616988; Wed, 21 Apr 2021 12:33:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619033616; cv=none; d=google.com; s=arc-20160816; b=yxgR4Nj/B5QlhVSt747lLOFFqFzg18lyOdgiuGA04Fv3oy33W+riXUAytTHD/TQe74 a4NkDenMtTTZuHMUMVLCar8N5Vr/ufh3KJm4YLfisK9xD/1zi10UjvrC/mBIgeSg2q8F ar7x+gPFJQHUtUeMB3qriYl9xHDskB4JSR2Hy8A90YqyQR3+ONCHXi220oY5u8tjEMd3 pyp9tAQlZlMZNecSl9Bz1+EXR98rMSkiEQuAf2yhRISxt8jpKJM9QFTlbIFLtersQQdE EOMQdP9UeKK09e2GpwX91qAhZ6oAaeVMh8CvbPjx77UI9KGCEbW3XHAbm5FQv3fwQqHL aBNA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=GdeaFJmr4R41Y4E4yOhKBfoqcgTi2vEOzTdmvFZZ1W4=; b=iUarxyRogKRO3ojj73D9GaM628A6jBNuXO4hoJrgQJVCxWeQ9HNJzuYYP1cMB4yVgz IBKiNNuSolkuZ8ClxEuhOORmybhSmZ4qN94M6vDf5E8i7HQ2DDimApMjgiFvRI+7bH5G PJN5kQRZ8eBa42UozHi5QrQX/dRmugFc+Q2y6foI88IPRyjGlYOh6rftWY8uvVDk6Wch Bdzj3OCuAKt9hcZJ+GrvVIo7wmm0NxAWTeI+3e0K+VuU3NK5Jf6iTk0eEtLQd9A+OW/W W9Zj67LtlglX9/uDBXpyt6CjYd0RxIcpiY6B4+HtOdC37GPBum6B0xaDBymPmP0SNwVm BlGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RcoadoWU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ha1si144076ejb.743.2021.04.21.12.32.59; Wed, 21 Apr 2021 12:33:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RcoadoWU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243179AbhDUOFu (ORCPT + 99 others); Wed, 21 Apr 2021 10:05:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235887AbhDUOFt (ORCPT ); Wed, 21 Apr 2021 10:05:49 -0400 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5B25C06174A; Wed, 21 Apr 2021 07:05:16 -0700 (PDT) Received: by mail-il1-x129.google.com with SMTP id b17so35010414ilh.6; Wed, 21 Apr 2021 07:05:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GdeaFJmr4R41Y4E4yOhKBfoqcgTi2vEOzTdmvFZZ1W4=; b=RcoadoWUmxnJ5L8BlTXlGBhA4FNExzqGlIz7mByRLnBOKRZRwuRPCcrRUgNhrfX+1s noqMbB3gBPbwuPBGSsiy/XCeAR/VfWH5wb99GJ17BhnMt7lmylH8iplFm1HbPAhDNUYi hy+RpBYJqznTyBRWP6Z3cBbHNaWoNMC1bFlKe8m6lpbr/lMS7oNakgqos3vN1G3ji5QR /zebHGIxKxdjYQlgCUMlalJ0rz2ogiXQ1Z4SBjpGpQgspq5Glayg4HED9LkcTPmUkxVs VRRNxF0fuEBN5BmI+z0t/mI7Q2m2lAg1hgL5GePNn9TQqZm7XlIHBe7qWmjeZpybPI0q kPdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GdeaFJmr4R41Y4E4yOhKBfoqcgTi2vEOzTdmvFZZ1W4=; b=Zit1uBzex0+mOocrnntsSou4u1OVkvECesye4d3WiXz+cMX+a85Vzc3ejq5eX8BGxB GkjC32JUbv2nG1cKteZmjuO6hp4nNuDbefHsjl7BcnzomTV/0F2zVBVPCt4TBJsumAv4 YGy0/yWHeCEDkjqwQfoIIbcA5YMQnGDSN8v/EoyjW4JP3DKBoDMrsKBcyo5V+7CD/8IC Q7Wx7Qb3f6Hf+8uDaVjLXhIuCwDsTPuO6sUzpxIfdecZFid6jJwW7hMEXtXVInSyo46r ThEqUqkBYmhg+qVWVMGOAiaDu+yszAOEhunfYxigBQoOnPv0ECT1gwa96r60goq1sdcu FJgw== X-Gm-Message-State: AOAM530nAw1yvwVmHDlnp6XMhvVJ1UhacVOTTppcc9ggEFMgAyt75f74 4bf6Cc59EMvYFJJE0t4kMNJjAtAMvtgh4A== X-Received: by 2002:a92:d70c:: with SMTP id m12mr26807944iln.216.1619013915515; Wed, 21 Apr 2021 07:05:15 -0700 (PDT) Received: from aford-IdeaCentre-A730.lan ([2601:448:8400:9e8:1b3b:2123:669a:3ca8]) by smtp.gmail.com with ESMTPSA id x8sm1133302iov.7.2021.04.21.07.05.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Apr 2021 07:05:14 -0700 (PDT) From: Adam Ford To: netdev@vger.kernel.org Cc: aford@beaconembedded.com, Adam Ford , Sergei Shtylyov , "David S. Miller" , Jakub Kicinski , Andrew Lunn , linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: ethernet: ravb: Fix release of refclk Date: Wed, 21 Apr 2021 09:05:05 -0500 Message-Id: <20210421140505.30756-1-aford173@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The call to clk_disable_unprepare() can happen before priv is initialized. This means moving clk_disable_unprepare out of out_release into a new label. Fixes: 8ef7adc6beb2 ("net: ethernet: ravb: Enable optional refclk") Signed-off-by: Adam Ford --- V2: Rebase on net-next/master, fix fixes tag, change name of label from out_unprepare_refclk to out_disable_refclk diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 8c84c40ab9a0..9e5dad41cdc9 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2173,7 +2173,7 @@ static int ravb_probe(struct platform_device *pdev) /* Set GTI value */ error = ravb_set_gti(ndev); if (error) - goto out_release; + goto out_disable_refclk; /* Request GTI loading */ ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); @@ -2192,7 +2192,7 @@ static int ravb_probe(struct platform_device *pdev) "Cannot allocate desc base address table (size %d bytes)\n", priv->desc_bat_size); error = -ENOMEM; - goto out_release; + goto out_disable_refclk; } for (q = RAVB_BE; q < DBAT_ENTRY_NUM; q++) priv->desc_bat[q].die_dt = DT_EOS; @@ -2252,8 +2252,9 @@ static int ravb_probe(struct platform_device *pdev) /* Stop PTP Clock driver */ if (chip_id != RCAR_GEN2) ravb_ptp_stop(ndev); -out_release: +out_disable_refclk: clk_disable_unprepare(priv->refclk); +out_release: free_netdev(ndev); pm_runtime_put(&pdev->dev); -- 2.25.1