Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2300471pxb; Fri, 5 Feb 2021 14:19:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvSzYn+5wGAlhQNRxNygIdr6bD7CRqJOUFf3qw4uqqNTJDWN3R/3gVk/zCaG9idSsnRtOq X-Received: by 2002:a17:907:11c7:: with SMTP id va7mr6026872ejb.351.1612563558624; Fri, 05 Feb 2021 14:19:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612563558; cv=none; d=google.com; s=arc-20160816; b=w9efaQC6DcolAn83fQXZ6vTAT9CTsw7xOHv4wbsXYQpTyMuN+CEJW//0UjqK6Fqf53 mxFCOIAzcnOzJpCVYjJNeu+wUZDFDORGy0yw6b0E4YM5euxW8mONwju0+xW9BefYGYra Im7oLmrlJa6w7B5U2GA69awa0LjLB5zxDfnLaPgfFF8gJR+xAAUazEb1vl5xT68AMUTI SfhPzds8M0RoulOFX+LCPhtIzZW3tDwDWMcGiP//1+21DkUW73pXRNul5QCM6xuG8FYh BXIOIpyqMc4pHSx5S6+ot5OhYhCzunF5q/C8xEm2vkxtiNDGUA0sJ4RK53zu+mwhnzC2 wOEg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=raV343diF2g1W2mHWHYFdmXC4LlG7fh/x+QUSm335EU=; b=Nad0ic24lRG0hqYiJSoG3wMjmB0WndWmhtLkJxSld6a7RRSfygJZQ6Swnec2NUlEkQ ZP7yJTpdr4lmY7dBFVOXCa5jn9Vx0/5VOshsn9L+cmegxUXvLzQ3uKV75X/TgzWHhcyO BJJLjvY0iFcsvCC2DPk1oPQZR+C+RVFe5G5NzOxndsEXZtT1f26mM9Oz3kZapQ+hLpc2 PxsOis3LcBgK1AnaNcYupvWhSbSRjLDt1hZB7P9m2BsjcskmkntaXoTwU0k1ar3YU2KM AEEfeQEdawJ6lySW4ZLRfHdmW+WkGdhf+a4ZixoZR0eZx1YpSdvQO/PtDQ7W4PnwP30F 7ptQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="U4F/NU9u"; 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=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 g5si6912482edj.194.2021.02.05.14.18.53; Fri, 05 Feb 2021 14:19:18 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b="U4F/NU9u"; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230124AbhBEWQQ (ORCPT + 99 others); Fri, 5 Feb 2021 17:16:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:44980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232932AbhBEO5T (ORCPT ); Fri, 5 Feb 2021 09:57:19 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 46EF165041; Fri, 5 Feb 2021 14:11:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612534318; bh=t4iVbYGT2b+UdWhfRq0nQXxQwPG4o8QeOCk6ejoRoQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U4F/NU9uZ9giw3FMyM53ZmqtKJz4O4pH6tuY8BkdBovvyZbSQAf0Xmbv0/PBx9xsO o7VQbaxnPNc79WLFQDpn7uLXgGyNLrj2rMqcaj3Hg51TUgMBQvulvoeBI5ylsxHp90 8DbzIN7MOZukV9MlP7pivd9kTZ997fs9z45CeQnY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pan Bian , Jakub Kicinski Subject: [PATCH 5.4 01/32] net: dsa: bcm_sf2: put device node before return Date: Fri, 5 Feb 2021 15:07:16 +0100 Message-Id: <20210205140652.414435105@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210205140652.348864025@linuxfoundation.org> References: <20210205140652.348864025@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pan Bian commit cf3c46631e1637582f517a574c77cd6c05793817 upstream. Put the device node dn before return error code on failure path. Fixes: 461cd1b03e32 ("net: dsa: bcm_sf2: Register our slave MDIO bus") Signed-off-by: Pan Bian Link: https://lore.kernel.org/r/20210121123343.26330-1-bianpan2016@163.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/dsa/bcm_sf2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -421,15 +421,19 @@ static int bcm_sf2_mdio_register(struct /* Find our integrated MDIO bus node */ dn = of_find_compatible_node(NULL, NULL, "brcm,unimac-mdio"); priv->master_mii_bus = of_mdio_find_bus(dn); - if (!priv->master_mii_bus) + if (!priv->master_mii_bus) { + of_node_put(dn); return -EPROBE_DEFER; + } get_device(&priv->master_mii_bus->dev); priv->master_mii_dn = dn; priv->slave_mii_bus = devm_mdiobus_alloc(ds->dev); - if (!priv->slave_mii_bus) + if (!priv->slave_mii_bus) { + of_node_put(dn); return -ENOMEM; + } priv->slave_mii_bus->priv = priv; priv->slave_mii_bus->name = "sf2 slave mii";