Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3950750pxb; Tue, 2 Mar 2021 02:50:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwSn4SJ3jo7ZZZ4+RjIEGYUJigBT4EhXiC6YoTjAg0wBiD+gmxMpZ9+QVl0CLcx6s6zeQKX X-Received: by 2002:a17:906:f9db:: with SMTP id lj27mr10634094ejb.399.1614682246605; Tue, 02 Mar 2021 02:50:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614682246; cv=none; d=google.com; s=arc-20160816; b=p2UhnWKoOIK72rOs7Ir+zjfCAir907ibRlOQul6FgJ8q5Ct88EXwlK10cie5LRediz 7Oc4tgdAVzFbniYOtGEJKVVsXoKhwRNGafjpxgi7efr7oxMuh7ZZ0DbygsHW4SANvdch PqAXtXr6OrdYLi5JaE/wA82dvwuBpuhFBHT4F7Hbtj/PPdNjiAgpqvBAaE4ExFGjGMVr Kd5L2cTCZ1Ova6MxzkdZ1LZrDiA8wbfg7aRFa6yEytyXbkIEJJDnle4HDwX515QaZVF7 8l8p09K1I0BAHJrF4nhB+Oow0SfVuq6BBEL/3m+ZWYXa9KbPEx96f8QfqP7C2jbhbFiq S5cw== 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=c7FbnTiOGmRHPRmPaRk8uhGlUUSqVyfwS+ktZSFwJjY=; b=afbe6FKU72gQYHG8qDRjtrvxveJowzAz3GjYx9GJaYbpAsZsebdj036M31OiryaV8V O57C66vKqgGTX7iAjtNTjb/D5UkgcM1VXC7IDoqP4bHVEPQ8pK6zjr4lj6q+G75ZNVfF 2gnel+mLO8qlgjjywOEbBglpqjGEnA3L77YSDMDzfu1R203nmFGhPSxpRx1YRs5mVRL2 W+uDJfyZp/ZktS6PsHmabdA3AEHEVGepXbjPIOKeJkWnW0HZwdZi8hEIdG+3aaN13yE1 IxyhPX2havzmoH8yZTnK3OFxBU333GMrAKQSViT2gw0/6KtfeYHecTauLj8wJhQE1uRz +SoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="P6+e+/Fy"; 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 m7si4317402edd.486.2021.03.02.02.50.23; Tue, 02 Mar 2021 02:50:46 -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="P6+e+/Fy"; 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 S1380227AbhCBBt1 (ORCPT + 99 others); Mon, 1 Mar 2021 20:49:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:48626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241533AbhCAT0p (ORCPT ); Mon, 1 Mar 2021 14:26:45 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id BA03C64EFB; Mon, 1 Mar 2021 17:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614619903; bh=Pm5Qd/vUJGfqfuzFL9tu69HEJlAfVbuJOcqpaTmj6Dg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P6+e+/FyQcX6p53wX3LglzqrVld+IVjuVjz1xADnnFiUs+riRlTKJ57HbjU/cNcfb bVhL1ciGqz2A5kR5MVzCVl4Hnp9TOigHnmcQtAAHaKJkIHwV8meGpsPKMU7YPNdCU2 D18d0NkpLl8JxjM0sywc2ZSX5nCxkQItqZV2xM2w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pan Bian , Tudor Ambarus Subject: [PATCH 5.10 592/663] mtd: spi-nor: hisi-sfc: Put child node np on error path Date: Mon, 1 Mar 2021 17:14:00 +0100 Message-Id: <20210301161211.154464302@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@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 fe6653460ee7a7dbe0cd5fd322992af862ce5ab0 upstream. Put the child node np when it fails to get or register device. Fixes: e523f11141bd ("mtd: spi-nor: add hisilicon spi-nor flash controller driver") Cc: stable@vger.kernel.org Signed-off-by: Pan Bian [ta: Add Fixes tag and Cc stable] Signed-off-by: Tudor Ambarus Link: https://lore.kernel.org/r/20210121091847.85362-1-bianpan2016@163.com Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/spi-nor/controllers/hisi-sfc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/mtd/spi-nor/controllers/hisi-sfc.c +++ b/drivers/mtd/spi-nor/controllers/hisi-sfc.c @@ -399,8 +399,10 @@ static int hisi_spi_nor_register_all(str for_each_available_child_of_node(dev->of_node, np) { ret = hisi_spi_nor_register(np, host); - if (ret) + if (ret) { + of_node_put(np); goto fail; + } if (host->num_chip == HIFMC_MAX_CHIP_NUM) { dev_warn(dev, "Flash device number exceeds the maximum chipselect number\n");