Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp2552349imc; Sat, 23 Feb 2019 06:00:31 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia1BfCP3XnSXvfo+zDm8X2rwQQloq6B7dP1MYN0KOCpEtNM8puaiVQydFUmDCJO8fWeTRtw X-Received: by 2002:a17:902:74cb:: with SMTP id f11mr9736269plt.180.1550930431169; Sat, 23 Feb 2019 06:00:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550930431; cv=none; d=google.com; s=arc-20160816; b=VeWGMQVSZ67kxPVwHux7+/I0mbq8LeS/1IyBaBEFF0eUa9tjMObKSRReLW7sp5v5g5 rHOosupPg3cVILyZWmrGjkA72jwpQKasGAtNyx5IbJiT+xEipmY/6e1h+U/5+XCL3Fyd WQRdm/TE7w1fHYPoqO5baWZY3t6MIX3EPIqxQkDWCOpV2HFPPldtydc7Y8Yr4gz9fo15 wK1/kdxzYP/d/eZfQGnBgFy9wa1rWjeHE9dJeGUa97E+8nrdbvuhw6HkoxFBEbOX6JrA 7aVKnyWImIzKortw5NhmdBYYMgW3Amsuww5goKaDKgXns1z9oXEK1orl7VZqAEmrufr1 sWWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=8XBoPSoHQwgwLkfXvAXWA2nVnYlqrIBk6fsV5dG7uhw=; b=TVBQBtN/yu0pXt90KIvlEaKre++fUd8Syv+GDIE23TI8f7lL/3XGcR684PamQhizsC Fo02JEjAnL63xbhrfOKeJEtAEPr/Mk/U12lnxUFy2uTPhX9ZOK2rf7PkTQssJxwBLxeH yKyC/oCAm3NkCfnRxn5GCNhKTmkcBR5lrXBJM8nTQ1LmTljGwGxo/tyXhGykFi6m8eVG WCYUaRkfBv5+zLp8dqGzpoxc4MRU9qGoZfEBosBpVjWSzpNfNFCdQFghH/wvjljf9DHL pHTfoEsyqklEXVrZn1yNZNb1Z/hptxhGR3wZcmg8WVfOoEJk23F4RPs/LtQxeUDHtxMH Qbkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9si4149142pfj.178.2019.02.23.06.00.15; Sat, 23 Feb 2019 06:00:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727878AbfBWN73 (ORCPT + 99 others); Sat, 23 Feb 2019 08:59:29 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:17560 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727989AbfBWN6w (ORCPT ); Sat, 23 Feb 2019 08:58:52 -0500 X-IronPort-AV: E=Sophos;i="5.58,403,1544482800"; d="scan'208";a="370609509" Received: from palace.lip6.fr ([132.227.105.202]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA256; 23 Feb 2019 14:58:44 +0100 From: Julia Lawall To: Jason Cooper Cc: kernel-janitors@vger.kernel.org, Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , "Rafael J. Wysocki" , Viresh Kumar , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/12] cpufreq: ap806: add missing of_node_put after of_device_is_available Date: Sat, 23 Feb 2019 14:20:41 +0100 Message-Id: <1550928043-14889-11-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1550928043-14889-1-git-send-email-Julia.Lawall@lip6.fr> References: <1550928043-14889-1-git-send-email-Julia.Lawall@lip6.fr> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add an of_node_put when a tested device node is not available. The semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ identifier f; local idexpression e; expression x; @@ e = f(...); ... when != of_node_put(e) when != x = e when != e = x when any if (<+...of_device_is_available(e)...+>) { ... when != of_node_put(e) ( return e; | + of_node_put(e); return ...; ) } // Fixes: f525a670533d9 ("cpufreq: ap806: add cpufreq driver for Armada 8K") Signed-off-by: Julia Lawall --- drivers/cpufreq/armada-8k-cpufreq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff -u -p a/drivers/cpufreq/armada-8k-cpufreq.c b/drivers/cpufreq/armada-8k-cpufreq.c --- a/drivers/cpufreq/armada-8k-cpufreq.c +++ b/drivers/cpufreq/armada-8k-cpufreq.c @@ -128,8 +128,10 @@ static int __init armada_8k_cpufreq_init struct cpumask cpus; node = of_find_compatible_node(NULL, NULL, "marvell,ap806-cpu-clock"); - if (!node || !of_device_is_available(node)) + if (!node || !of_device_is_available(node)) { + of_node_put(node); return -ENODEV; + } nb_cpus = num_possible_cpus(); freq_tables = kcalloc(nb_cpus, sizeof(*freq_tables), GFP_KERNEL);