Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp120583iof; Sun, 5 Jun 2022 23:00:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6y/RBDD8VDEV3McHIp9R+09qZQvvuxNPkWiAWARGNKbnDiYFzX7WYqbBTV6b1vLRlI+fQ X-Received: by 2002:a17:902:d481:b0:167:770b:67c with SMTP id c1-20020a170902d48100b00167770b067cmr5517608plg.77.1654495207592; Sun, 05 Jun 2022 23:00:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654495207; cv=none; d=google.com; s=arc-20160816; b=Q79lnnmTeHsYfB1ForChccFWz+io0A+pjnR+84QOBrIsJ1TN1S3TOGXG/lplZiliKh gFQ5lChPd5p499PwS6TQM6ljgrYSuvU5TIOYPjeneKIqDTEt5kbIvNKzmPhgVMmIzYSD G150BxWSfCFZq4ZiESIWIFNdLtUowarI3giOPpxsnFJ1cjY4QbiBLfHxXYerWQ8T9Urx N2xv+DZmzp7AqfZxaXKo6X4CR2SYmrsK4kUepFw9RCWLWThGHHsx9AIJsvslyhep3WL/ rBLkuEBBEJ4WN02QIBFVMoCx7PCmc+/8ZRw/wHZLEH+mh4oTDFVWMGb3XZFQFmu1E7vK wNJQ== 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 :message-id:date:subject:to:from:dkim-signature; bh=aQpfNS+r3gvm5vQLoUP5fF1DHiiFVqBEBMp9DZpwHMg=; b=pZaRH1CgRjsTKaLRqFgD+fx9D/gi845nMe7oNM4ka/sipNwbLKsIOD514MKcsywMvR x2xTw4RoLYIqJoyYVtGtfC9T6tSgsgyT2REwwhwp151uRomU1YivwQ1yV3kg+9sEIOf3 25swzPjd//78DTtkzkTYoLjjy/oy3+WpvBAzT/jroCdUGj4Iy1XQG7YeUhb4vsDiZoqm 5rtCg37m95L0kMjkS/lfL0aKM7vJJAZ2nSoAU6m2Yp5jixrGzbmjq4Os/bnxVC0pg/g9 +iDc2sue5EKIORuFsbDCZZE2Xsq16uwpZoI9h9svYh907n6PHQHMEjR3VoPElTyGHFdt /6lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ByZRoM3j; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c133-20020a63358b000000b003f27e1916bbsi20783433pga.162.2022.06.05.23.00.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 23:00:07 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ByZRoM3j; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E77D52FA61B; Sun, 5 Jun 2022 21:48:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350829AbiFEIkt (ORCPT + 99 others); Sun, 5 Jun 2022 04:40:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236304AbiFEIks (ORCPT ); Sun, 5 Jun 2022 04:40:48 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C5682FE7D for ; Sun, 5 Jun 2022 01:40:47 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id b135so10440919pfb.12 for ; Sun, 05 Jun 2022 01:40:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=aQpfNS+r3gvm5vQLoUP5fF1DHiiFVqBEBMp9DZpwHMg=; b=ByZRoM3j4iaoXqTKvHAn7fzsSjnQ8NhbYHK516s5FZMfOfWFv/TV0PfKtxGmIonTwB lTW2yqOaYYmzt0mgGeOiFrCczqJ7lPYyM4mQGCdE6r7bT0GjYrJiVDbOt4USH51kSu3Q shiGoqzAZ2wUOxdOSDY37JVQNRfrAkEQ0pkZO30C+4V9Kt4h4bJPDBAnvGXeCTTGeRYo q2qO5Ru+m4jav/aDxTUxiOXQg9eRGVcRuOw32UHyCOiKI/6eJQ0KkZJQlNmoxT6cQ92J 390OTsj2DFvHPznpgkBQk6b9FHUuCBr57ihuSojNrEXmFJGBJ+emd4eLLrfiQ/TFr62v z2Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=aQpfNS+r3gvm5vQLoUP5fF1DHiiFVqBEBMp9DZpwHMg=; b=ownqso0msvfjh6nL7NaiSP58apDzFq5hAYdhY4DsA/vNN8/7dAByEI3L1hGbqsLii6 EsVpiXAvDlt9jdJi0iOyrR2N7DJZB80gUAWd3DhuyRxvm8274/3nIKnLSuNnwaQQKNbI YtqphKyU9omyGIvyeYanOffqXzmDGWbcipFDs3TBB8qfHoLgmHf/aOObqPKNo84HOOyd tar9KEyQmfnLWDAEAtzI2usJfFbb3LbVLy2RW5yFnaUGxGtE5sA7YDz6fnqhBtcBP3Eh 9ZJvZ8teD9XTw9zlX4EZkjhv1w0wWRVL2S47GLmdMfFKM22kPEAxCPGJeuYksdPEwo37 eZ2Q== X-Gm-Message-State: AOAM531uWA6dP5XCKYkkQcS4+PkcrZfFe+Vz2hSd+VkQYhkVFuymm3KA Cve2TA5yl7tuz9Px71lOkbc= X-Received: by 2002:a62:de84:0:b0:51b:e34b:ed2e with SMTP id h126-20020a62de84000000b0051be34bed2emr10837648pfg.86.1654418446975; Sun, 05 Jun 2022 01:40:46 -0700 (PDT) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id d15-20020aa797af000000b0051bbc198f3fsm7756810pfq.13.2022.06.05.01.40.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 01:40:46 -0700 (PDT) From: Miaoqian Lin To: Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Mihai Sain , Miaoqian Lin , Sudeep Holla , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] drivers: soc: atmel: Fix refcount leak in atmel_soc_device_init Date: Sun, 5 Jun 2022 12:40:32 +0400 Message-Id: <20220605084035.27127-1-linmq006@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 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("/"); - if (!of_match_node(at91_soc_allowed_list, np)) + if (!of_match_node(at91_soc_allowed_list, np)) { + of_node_put(np); return 0; + } at91_soc_init(socs); + of_node_put(np); return 0; } -- 2.25.1