Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4185014pxk; Tue, 8 Sep 2020 12:56:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEg9KlfQ/nU7rVFCEhPUNTBk241gcgvCErNYLyw8i7EcdRxkrsikJ6BekFp1nmX/8mlHsQ X-Received: by 2002:a05:6402:18d:: with SMTP id r13mr646072edv.267.1599594974494; Tue, 08 Sep 2020 12:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599594974; cv=none; d=google.com; s=arc-20160816; b=sld9A1DYmqcdcNP4VA7qf0NQ86m3rbElph5wZvL42sMSGdavAHm88JVSefagSxd7FB WngcF5jk5qB/kE5ulrj15v9oLqmF8yS+kNCsfcx/pCKbJyb3KLe2+wINmVYFybt0Q5/p /ngT15iR3O9KEVczGlFt0ckhPsnQ1gPLD9hpKSGMNrUtRJJpsdW2NEFnZjkGf2B8h2we hj/ieh4s0Z9k+TvdnNYCK8vG49UIHJoN/bHmRXI+QuZGuJ6zqkqYq0BYgUso76Xp/TTg T96t208M8JvqpGDUz4x7dreAsiSzlgMZJ6frLqzE8aZZNBecQUiqsAZ5gGXepNrEWx0u nM+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tK+hOILzM1LQNw9SfzE549aXL2LFlAGO2on7Dp+pY9Y=; b=UWlBBGKVGEJA+2yKKjEaJ8o5+gOcozbvXahrZn7jOk9wHw0TTr6YJDyNWxfohkWl5g 7Sd/TVYJ4bR7/0ash/w17mhjjtXtKXBgrstXIGv17833DsWkrmC3FiWMhsKxl/FZuviw 6iYHBwRPXE4Ln81Vr6tfCTUYUTVaQvGQGrX5WSTJx1FN2lb2QOvFCv80ehyQUrK5WiHX 6qLoFTuhN8j/iW1PmGEWaszi+gJoNl0fq0XbQzcO4MbhikgQ/bngBr6w1JXYpgwEMeMe avVeV+ju4FH+Ar/tQFr9uZh5BbBssvOAQmOK6wj22LilYMC+kRMqPAW6rRKVfoWzBc6B Jetg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=o0Z0iPYy; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id wq13si4125ejb.722.2020.09.08.12.55.51; Tue, 08 Sep 2020 12:56:14 -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=@kernel.org header.s=default header.b=o0Z0iPYy; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732432AbgIHTxF (ORCPT + 99 others); Tue, 8 Sep 2020 15:53:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:38044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730677AbgIHPsF (ORCPT ); Tue, 8 Sep 2020 11:48:05 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7331E24822; Tue, 8 Sep 2020 15:44:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599579852; bh=sP1EMyZ8HKx512ZxO6MKvWKyrmUmqk1KbcTSd+MmQWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o0Z0iPYysRDqFHaJbOO1CWlL3H+yX/CoBhS2AfORmr5zsiDLFZxW1FgYxpW37DTbU BNCmdbv/DtXkVRLxjuCUpCwoYz/eIzFwfdppzH1FfV5WPD/ypUqsvfH6iSmU3fqtxs ui2dWy7T16962B6YMONuV3gWr8OSPv4h4cRIxk9w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 060/129] net: gemini: Fix another missing clk_disable_unprepare() in probe Date: Tue, 8 Sep 2020 17:25:01 +0200 Message-Id: <20200908152232.701073723@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152229.689878733@linuxfoundation.org> References: <20200908152229.689878733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit eb0f3bc463d59d86402f19c59aa44e82dc3fab6d ] We recently added some calls to clk_disable_unprepare() but we missed the last error path if register_netdev() fails. I made a couple cleanups so we avoid mistakes like this in the future. First I reversed the "if (!ret)" condition and pulled the code in one indent level. Also, the "port->netdev = NULL;" is not required because "port" isn't used again outside this function so I deleted that line. Fixes: 4d5ae32f5e1e ("net: ethernet: Add a driver for Gemini gigabit ethernet") Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/cortina/gemini.c | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 28d4c54505f9a..c9fb1ec625d8b 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -2445,8 +2445,8 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) port->reset = devm_reset_control_get_exclusive(dev, NULL); if (IS_ERR(port->reset)) { dev_err(dev, "no reset\n"); - clk_disable_unprepare(port->pclk); - return PTR_ERR(port->reset); + ret = PTR_ERR(port->reset); + goto unprepare; } reset_control_reset(port->reset); usleep_range(100, 500); @@ -2501,25 +2501,25 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) IRQF_SHARED, port_names[port->id], port); - if (ret) { - clk_disable_unprepare(port->pclk); - return ret; - } + if (ret) + goto unprepare; ret = register_netdev(netdev); - if (!ret) { + if (ret) + goto unprepare; + + netdev_info(netdev, + "irq %d, DMA @ 0x%pap, GMAC @ 0x%pap\n", + port->irq, &dmares->start, + &gmacres->start); + ret = gmac_setup_phy(netdev); + if (ret) netdev_info(netdev, - "irq %d, DMA @ 0x%pap, GMAC @ 0x%pap\n", - port->irq, &dmares->start, - &gmacres->start); - ret = gmac_setup_phy(netdev); - if (ret) - netdev_info(netdev, - "PHY init failed, deferring to ifup time\n"); - return 0; - } + "PHY init failed, deferring to ifup time\n"); + return 0; - port->netdev = NULL; +unprepare: + clk_disable_unprepare(port->pclk); return ret; } -- 2.25.1