Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp2553298imc; Sat, 23 Feb 2019 06:01:24 -0800 (PST) X-Google-Smtp-Source: AHgI3IbvDyV7q2ZnB8k6+apWCZWF0o7rMLwcvwODns/yXpWb8FHcUrmUV4LIur9N/MvouX/USnOC X-Received: by 2002:a17:902:7007:: with SMTP id y7mr9510898plk.167.1550930484885; Sat, 23 Feb 2019 06:01:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550930484; cv=none; d=google.com; s=arc-20160816; b=lficxz/7Gtc9oRRBWK8Y7AjivmKcJrHmKiG92eY70TPa05bx++vdt2bl06CryuBb4d ykFNStnkCuoMDxqPCOhY3579NAayfgbpEr9Z3VHLmHFhPMxplKB57+7INzs7htIHzd6q V3/lXHedd6Lk3VfXtZMbnNy3nS4JfGSYDFd5f+/911QFi4X3RBLNP1KHUkzycOI7NQ1B Rt0CzxikCHF81l6tk7UlCTEWpyR/ifQOJDjManeVklQmybkecrSJNeVz6FxxjQ3rIdlx iUytEAsi8kN96yPE6828NuFy6rV6C5g682KXwgPPoe1xdXvGQg/04KS/MHX/NtjbBOhZ xMkg== 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=IBg8LK4y7aTH5pKM2p1FJdOBsAqfUVEMMClYFDyUrDg=; b=vpwEjxb9fAwg7B0zOz6H1Dg0ZabS8cTcmFs7saBugckVCqctrtQ0+853sdYaqzJ8N7 YQ2ewcDk+pdC8bMe+SOrPKElapwNIl2+YNw5ovmqzpI6d85/7tNvPgK7cKpwzrlFIa34 ZFe0LfTX+UrSAe4zy3PIzGqN75QoMP1ReTeS8x6W//xObCO4k7c6K8YrwrJEYTqCK3Yl w4XOvJOwo0WMXFOHOwxPaZAKkxBBG7P1joZ6UOGZ+5qcHtcydFgX5xVF8ZVIMeV9tnhP zQNP9XwlWWIcnyMDbZqbA6DSj/1MQHr1Z91zEvZ9uZgR1OMHwjyAqAVYyhu6s2DKBQl/ 7ngA== 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 v186si3686325pgd.1.2019.02.23.06.01.09; Sat, 23 Feb 2019 06:01:24 -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 S1728108AbfBWN7R (ORCPT + 99 others); Sat, 23 Feb 2019 08:59:17 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:17561 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727988AbfBWN6x (ORCPT ); Sat, 23 Feb 2019 08:58:53 -0500 X-IronPort-AV: E=Sophos;i="5.58,403,1544482800"; d="scan'208";a="370609508" 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: Kevin Hilman Cc: kernel-janitors@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/12] meson-gx-socinfo: add missing of_node_put after of_device_is_available Date: Sat, 23 Feb 2019 14:20:40 +0100 Message-Id: <1550928043-14889-10-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: a9daaba2965e8 ("soc: Add Amlogic SoC Information driver") Signed-off-by: Julia Lawall --- drivers/soc/amlogic/meson-gx-socinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff -u -p a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c --- a/drivers/soc/amlogic/meson-gx-socinfo.c +++ b/drivers/soc/amlogic/meson-gx-socinfo.c @@ -123,8 +123,10 @@ static int __init meson_gx_socinfo_init( return -ENODEV; /* check if interface is enabled */ - if (!of_device_is_available(np)) + if (!of_device_is_available(np)) { + of_node_put(np); return -ENODEV; + } /* check if chip-id is available */ if (!of_property_read_bool(np, "amlogic,has-chip-id"))