From patchwork Mon Dec 10 16:26:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 10721583 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 08661112E for ; Mon, 10 Dec 2018 16:26:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9C6D2AC5F for ; Mon, 10 Dec 2018 16:26:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBE152AF19; Mon, 10 Dec 2018 16:26:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96A142AEA7 for ; Mon, 10 Dec 2018 16:26:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727680AbeLJQ0o (ORCPT ); Mon, 10 Dec 2018 11:26:44 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:33214 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726392AbeLJQ0o (ORCPT ); Mon, 10 Dec 2018 11:26:44 -0500 Received: by mail-pl1-f194.google.com with SMTP id z23so5488434plo.0; Mon, 10 Dec 2018 08:26:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=zbmStDBNmYRujmWOzPMjCrtqy+G4MLvgr+sv4jD/SdA=; b=QSbgr9om9u5opOgTyTZhKtKqHSXcep7JiYFmz3zpcY4S2L/qGGhwXRxsel/D67ndVx OOumnuhs2kZho6BVTmN1eqm9xmqsJDDTiSwFInOdFL1Vd1/TMmISEqGg5D4Jj/iQ/cJW 08Qp/BvedocA5i89Utit4K77JW6yC2XI+YNmyUrlMIqUKhynkEiC0cy9dqWEktSSnOfQ TriqCIYoNqUKH3jyS4y6pVWEb4RXoE5eGkFLQadDiNn8H+O0jqeXrF1mO65urbFnw+P4 vXerdqqWZbrPCUKeKh5b6wZTAuNje+QqnZr7p3vUD56qpkfcU7fZzrcubwaF2DyQsyOS sgKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=zbmStDBNmYRujmWOzPMjCrtqy+G4MLvgr+sv4jD/SdA=; b=PjH8b9dOAQ4bASXyqql4lU1NZmQ2IbWIICur/nCHw6La4qAtHrlkKkiCD0dWhNSxxZ 18VGc17wpcgJbFbThdZG3CDkZs10NTjAWJpQ3JUoTUld+lxWOl10U9B2G198qXRnWVPz GyE9RfUOV8e5OhJCi53FN2UOIM3XSJ/wrvz2y40BFW0vZsiz+E52F2qF1uS/ubsr8Th8 ajRJqUD8eVhWULY6ryebN16g/B3XPDXdp5/yrRANCfFRV2cRt8M6bGWm5Aj7bSm7Hmgw 2Rq/9VY/E8WrhXIZz9oexQQA1aFtQ6ffRpEzplxrTKLnioVzk6SqDpCHy9ecMojLW+Kk L1PQ== X-Gm-Message-State: AA+aEWYRhI/v8K9JuSUk8VWo/QDiueN+7i8pSulGB7ST3jkNXLCm/0yD +7LtY+EEel2SRjNpPA+zzGQ= X-Google-Smtp-Source: AFSGD/XPYD3BN+bTIY5M/hlctqELfsTaJAEUf1sroItPS9sBMTlo8kq1Ia6DRr0RAdeuFZcc1d2Ljg== X-Received: by 2002:a17:902:9897:: with SMTP id s23mr12157224plp.69.1544459204050; Mon, 10 Dec 2018 08:26:44 -0800 (PST) Received: from localhost (68.168.130.77.16clouds.com. [68.168.130.77]) by smtp.gmail.com with ESMTPSA id q199sm19875892pfc.97.2018.12.10.08.26.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Dec 2018 08:26:43 -0800 (PST) From: Yangtao Li To: lorenzo.pieralisi@arm.com, daniel.lezcano@linaro.org, rjw@rjwysocki.net Cc: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH v4] cpuidle: big.LITTLE: fix refcount leak Date: Mon, 10 Dec 2018 11:26:41 -0500 Message-Id: <20181210162641.21029-1-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP of_find_node_by_path() acquires a reference to the node returned by it and that reference needs to be dropped by its caller. bl_idle_init() doesn't do that, so fix it. Signed-off-by: Yangtao Li Acked-by: Daniel Lezcano --- changes in v4: -update tile -refactor code,suggested by Daniel --- drivers/cpuidle/cpuidle-big_little.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/cpuidle/cpuidle-big_little.c b/drivers/cpuidle/cpuidle-big_little.c index db2ede565f1a..b44476a1b7ad 100644 --- a/drivers/cpuidle/cpuidle-big_little.c +++ b/drivers/cpuidle/cpuidle-big_little.c @@ -167,6 +167,7 @@ static int __init bl_idle_init(void) { int ret; struct device_node *root = of_find_node_by_path("/"); + const struct of_device_id *match_id; if (!root) return -ENODEV; @@ -174,7 +175,11 @@ static int __init bl_idle_init(void) /* * Initialize the driver just for a compliant set of machines */ - if (!of_match_node(compatible_machine_match, root)) + match_id = of_match_node(compatible_machine_match, root); + + of_node_put(root); + + if (!match_id) return -ENODEV; if (!mcpm_is_available())