Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp251677iof; Mon, 6 Jun 2022 02:45:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTNGjHTe3TD1AzN5NzXHQit5L8YuP/wgi0+q9W1/z7Guy/GuRgf77Xv1c/8Ch9069GdP8D X-Received: by 2002:a17:90b:17c7:b0:1e8:5136:c32a with SMTP id me7-20020a17090b17c700b001e85136c32amr13664781pjb.43.1654508746731; Mon, 06 Jun 2022 02:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654508746; cv=none; d=google.com; s=arc-20160816; b=rD5EMQEH92Fu9kH2XxwrRjQBUp+fb86d5yTRmfmk3jecAA9+5yXHcfDiriT+aWgFl9 IYY4OZeG1GgZsWv2xsxW4+3KqwHPZuafr4BQfPAmrUzH8Pcx8ISzI8an1z5Pq6BRCYtB rioMr4Ax9Fg29lS7sMgTA326z8fRWRngo1r3GZaOA1WZqN+TH2wXUdf33CrzUjQOqGTC scS27ccWN12Tj6/0ctz5ENkWClYZLELrHOSnTEXSy/E++CfG8JSj12ablZ9wW+acYQl1 +EKLwNk9D2RAPNSHyqTKaOy/xdlcF3rakLp7MJXEmCcCBuvhnvBlzxfLOkADSikK9Xhe Kavg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=wtNW4KiOnqpN8YunGYvJU0ZFACCmVUDwb8vyrufX79s=; b=rLV2lAHvK+8Le0c2C3jq+Bzwah1JeNVaFIp+rl2v4MS/h8L5dMamItDm+Y9F6dpg0H N4XSnuB9KCOl+XZOdHEdIShYOW9YIhhueS2N3xA1rjGxB1sqeh8je1XSEEw3HQALRJIi rspWqHy8mlYgb7kwfcZpxDJrp7zUUz1GB49I8/cdYxtgKKao6FhEL0EhMqlLHLV2iN+z jWun/8mn8RI0n7Hw5RnUGOQz3Fc95r7+pdtK/QYMrjz7jhshEgh9wypTunlzd+uqKj05 d3gq+O6IOhIojKcqagf9aa2oB0Wx/0BLYZk4LrDJG6eRLURF3o79LIMbD5uJmePvImUe RSbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a187-20020a6390c4000000b003ab9d94aaccsi19790616pge.328.2022.06.06.02.45.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 02:45:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 51DB26B025; Mon, 6 Jun 2022 02:23:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232815AbiFFJXf (ORCPT + 99 others); Mon, 6 Jun 2022 05:23:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232813AbiFFJXI (ORCPT ); Mon, 6 Jun 2022 05:23:08 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 34D9E1209E for ; Mon, 6 Jun 2022 02:23:06 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8FF4011FB; Mon, 6 Jun 2022 02:23:06 -0700 (PDT) Received: from bogus (unknown [10.57.9.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A57AE3F66F; Mon, 6 Jun 2022 02:23:04 -0700 (PDT) Date: Mon, 6 Jun 2022 10:22:16 +0100 From: Sudeep Holla To: Claudiu.Beznea@microchip.com Cc: linmq006@gmail.com, Nicolas.Ferre@microchip.com, alexandre.belloni@bootlin.com, Mihai.Sain@microchip.com, Sudeep Holla , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drivers: soc: atmel: Fix refcount leak in atmel_soc_device_init Message-ID: <20220606092216.5s54nzplpsiyj3bv@bogus> References: <20220605084035.27127-1-linmq006@gmail.com> <48c19453-984b-c3ae-b62b-2f0455330084@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <48c19453-984b-c3ae-b62b-2f0455330084@microchip.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 06, 2022 at 09:00:52AM +0000, Claudiu.Beznea@microchip.com wrote: > On 05.06.2022 11:40, Miaoqian Lin wrote: > > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > > > of_find_node_by_path() returns a node pointer with refcount incremented, > > we should use of_node_put() on it when not need anymore. > > Add missing of_node_put() to avoid refcount leak. > > > > Fixes: 960ddf70cc11 ("drivers: soc: atmel: Avoid calling at91_soc_init on non AT91 SoCs") > > Signed-off-by: Miaoqian Lin > > --- > > drivers/soc/atmel/soc.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/soc/atmel/soc.c b/drivers/soc/atmel/soc.c > > index b2d365ae0282..46dfa24c52fb 100644 > > --- a/drivers/soc/atmel/soc.c > > +++ b/drivers/soc/atmel/soc.c > > @@ -369,10 +369,13 @@ static int __init atmel_soc_device_init(void) > > { > > struct device_node *np = of_find_node_by_path("/"); > > > > What about having it like this: > const struct of_device_id *of_id; > > of_id = of_match_node(at91_soc_allowed_list, np); > of_node_put(np); +1, I was about to make similar suggestion in couple of other patches making similar changes. -- Regards, Sudeep