Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2281421pxb; Fri, 5 Feb 2021 13:43:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrhn9DI3hvjH2ia50hKMvwq5v9aRsw6Sy5dHoD8rWVIPE6klmZzo/vYUUOlqRFPAIAv4N2 X-Received: by 2002:a17:906:37c1:: with SMTP id o1mr5764587ejc.488.1612561394748; Fri, 05 Feb 2021 13:43:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612561394; cv=none; d=google.com; s=arc-20160816; b=wcnZAMPA+LOqxAHc9sNWU2805n7wqnQixUSn3NIMa/XF4ZbOBnqTmrXOYx4GhjlwWQ o9/FtzpinhN0vZkjc0kakujn26UBUx+bSbI6c3Cwb7AkRX5YrlchyCAqXbJJe/cLCJvM cHQGfmuto3pkeoJx5WfDVuZfyrsZ0cXxOslmFlx0Os8jLmCCvIuWjQimxDmQaagh3ucj 11wPRPoFY6emm9zVCUgMOYjKGyVTW0CY4T2Z0qUGuE5EG9PBT/Pwf2cY+8F/KBp9U96N jrXwCyUW9/buTmrqVXkthBZ8g1r4JLmQQtFWbKOud10uVXmZCGp357DMDYG/7A+autAU NnVA== 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=rYqgwBhBiDZcTlbDoZlE7gadpM+zVF+5SS/yeWchEIA=; b=vMH8ChofNCzjdmZoJTXxiVVmNsCwGCgrqrhOO+fz5KG+/KRcvt9eqjLOf5ort1HX50 M9roeuIaJnbxDBvr7QfA0sCs3zIrEIM7qMHSsHcP9egpnLJNHN3hWa3CA5gFRGviR0hy l0e0OLoWbXmYsz4or0Gdym5SbriPiDtdrPSlToXUl4BuqD9/zQiTk43j9JsyzQm3cO0S qfl0E2yWJUn3ymJuiWGcLKYnSk+VQeAofSYsrAaK0CKr8s1sfR99DU+GUL29VfBuTdlm BMVwZND34dzUHoZwQpLH10+XPhW4DQlv2BoxUcmPKmSPxtChe5MpCG1lsVdG0218lMwH LR6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n0oNGBaw; 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 k21si3956986ejx.367.2021.02.05.13.42.50; Fri, 05 Feb 2021 13:43:14 -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=n0oNGBaw; 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 S231575AbhBEVlm (ORCPT + 99 others); Fri, 5 Feb 2021 16:41:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:45588 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232771AbhBEO77 (ORCPT ); Fri, 5 Feb 2021 09:59:59 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 65B5B64FE3; Fri, 5 Feb 2021 14:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612534222; bh=Ri1yv9FwCj2BY3UclfkYxKrTZcSB8oBr6UKVF41Fx04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n0oNGBawf/gv7rS0W8MZrZQcqXO1YdKXYQIy5SIonr1Pf480wdTJjlmO+atihc63J SrXdCGtWF2DMxHY7s4pzLJNpobRdObkJyCM5fFVg1h/XoJ6+hTYkQscb8qSEQAU492 CRIaDznjcmEJIhZram5gVO+KfwBA8FUYDEcCDkVg= 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.10 07/57] net: dsa: bcm_sf2: put device node before return Date: Fri, 5 Feb 2021 15:06:33 +0100 Message-Id: <20210205140656.290041582@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210205140655.982616732@linuxfoundation.org> References: <20210205140655.982616732@linuxfoundation.org> User-Agent: quilt/0.66 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 @@ -509,15 +509,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";