Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp417587pxb; Wed, 3 Mar 2021 06:36:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJsH3NG5U11fPc9guZQYj0/6D7Rv9+mjExNrpmuJyEcy1ATJmPmOeLCPGa60GmjftYVT/Z X-Received: by 2002:aa7:dd99:: with SMTP id g25mr14590064edv.230.1614782206754; Wed, 03 Mar 2021 06:36:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614782206; cv=none; d=google.com; s=arc-20160816; b=GoO/SF6XybNzLXNMnmdoMlDgpYkb9qT8cr4KINxSG+7e1+G5+D1wZduMYJd1ByXCE5 5cXs+Q0TmP0RGZvCD3PC/XS87a6Wq3AusCkli4ibGNK8wos2l0HGInj3ZAe5+HxYgVj6 cq5q/xMDJREfVe9V1OF5PdWlrDe4hCJje8jSdSAnv0P95N4TWlkqOQ5WjkNWrnI2C94d RHZDaPtGzJNxBblUg1yBrfgTmHoOvAQMCYBjv9pOilOPOXfVPub+mGBOjLCopEajG2N3 1ZrHFNrKKrRjVo1Ixbh/kl47TJifXxBme9bHLq6f/jigKLmv96zUQExydfmV5gdRcjZL ngJg== 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=KLPf+vDLEpWdCY0cGw3ghOszvPnggJmgkAuM2YClEcA=; b=d/fh++iJmudmlXC3E14PmRwuTjBaTcl9qiIvSveGN3qX4Oc51Gl8PV2pHaVad7R97C xlVlX6MAltOeURwcs80B9yRzp3oK6K+DctegOinQQr2mx09uWQ+IeQ0werZC5M08BX+1 C16WMJ9vxKf3QaBdYet5YU2SoFlnhzvWVhP0FuAcb3Q8HMxKtGxt8CjBCL7+focSDeC2 jdlN8sNr3AJO609uVao+eXufxjjuYsZ3BvEFbj9hX2q1l4iRAjOg1l3rf7K+E2BIcexO /DCoF45oqt7+xTM1oK4lLjdTohAahOY841Q1g/YFG9DxdLENHWhcZVm6AnbzBjRVCola bK9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S1oLtzMd; 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 cd22si3677953ejb.384.2021.03.03.06.35.46; Wed, 03 Mar 2021 06:36: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=S1oLtzMd; 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 S244682AbhCAVZE (ORCPT + 99 others); Mon, 1 Mar 2021 16:25:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:48196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235272AbhCARPq (ORCPT ); Mon, 1 Mar 2021 12:15:46 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 81A9865043; Mon, 1 Mar 2021 16:45:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614617146; bh=TZYeEesn++qS4uS8yVkk7nZSXzXcbE9PBrkBxofhgkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S1oLtzMdI2Roa28+yl2Mfr5tmaIBBSc9YTguegwSdOaza+ymQAuUkejSGhgB+EkVv 2zX6HWKFo/GG8Q/3SIF/B371C0s0jPrSKS1KYv/+p76v1td0yiv26BNH0C64OSirbJ W1xTjJKULEci6YNQCti7Ao7VpZUJdh0DodvKBSS8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pan Bian , Tudor Ambarus Subject: [PATCH 4.19 217/247] mtd: spi-nor: hisi-sfc: Put child node np on error path Date: Mon, 1 Mar 2021 17:13:57 +0100 Message-Id: <20210301161042.297058371@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@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/hisi-sfc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/mtd/spi-nor/hisi-sfc.c +++ b/drivers/mtd/spi-nor/hisi-sfc.c @@ -408,8 +408,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");