Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp2551778imc; Sat, 23 Feb 2019 05:59:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IbRZbS0210N76LMyywY9Pd2TU/isdmMkjfU9PGicAeHPNyQANyuKM9qIKT8ftZmhyv+u/Ez X-Received: by 2002:a62:2a4b:: with SMTP id q72mr9449740pfq.61.1550930398139; Sat, 23 Feb 2019 05:59:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550930398; cv=none; d=google.com; s=arc-20160816; b=iGF7ugZbXI/bnlznLoTXbbo6dyne8JG3zyDgp5HvM5uffsQu/sGVvd0kmTzJlba+d9 ac+pQJd+/GVL9INmOaiZjV55Ii7EBO/DtbSGtPG5SkjsamvZI884gjOCmtZZST76eJHO QJsm1RA1O+PsH8/SHqaOBuFW01gPaJRyQYrcg+u60jlBOum0uz1V6z8o17QcYZBfQhKk o3owSGTDInBySOgGxozYTF5eAiVznMudZLi0PIgGEtW0HnkkLUBw+q99voTfQPcv4hy2 lfy5eyIv+sQOS6/LXC3TY9186nYilGpS8jLc7lY3U57cogylXcS4/wTl8AVfpUeXU2lp I1zg== 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=4865mU9TbTch4ti5ShyarbU5vdvkFaP1/BhjXq6p4Go=; b=MUdXQUn50tN5Lxe/kotGNA/tCSuD73ka2U39EaonMxEXOOxp/1ab6fwR7+rQytmaQq DkCdiU3v+vg/sF/uMOqr575Hi5IY1zQQ1ztz7V18tIHD2RNPAKiIRM6hXnPB6ypcNNAf bRH+aPeLLFDVbYZIyW0eb+yGvSywK6dpkyc6c5+te4qbdEjO3p37C1EcQy0eMstUOaLA 3ygETkcZrlpHsrkpYzWYA62sl1SKfIPyej4A1abSz1Ta26Cbr7nToMGIKkdDAEZHOD5B QIKQEhmiKeFDc7JjL/Yf0I4BqNMggk27jw8sb7B7lltJcRjnWhdyX4I72Ui38nJwmDYS N56g== 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 f9si3856393pgi.76.2019.02.23.05.59.43; Sat, 23 Feb 2019 05:59:58 -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 S1728086AbfBWN7K (ORCPT + 99 others); Sat, 23 Feb 2019 08:59:10 -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 S1728014AbfBWN6y (ORCPT ); Sat, 23 Feb 2019 08:58:54 -0500 X-IronPort-AV: E=Sophos;i="5.58,403,1544482800"; d="scan'208";a="370609511" 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: Mark Rutland Cc: kernel-janitors@vger.kernel.org, Lorenzo Pieralisi , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 12/12] drivers: firmware: psci: add missing of_node_put after of_device_is_available Date: Sat, 23 Feb 2019 14:20:43 +0100 Message-Id: <1550928043-14889-13-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: d09a0011ec0d5 ("drivers: psci: Allow PSCI node to be disabled") Signed-off-by: Julia Lawall --- drivers/firmware/psci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff -u -p a/drivers/firmware/psci.c b/drivers/firmware/psci.c --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -677,8 +677,10 @@ int __init psci_dt_init(void) np = of_find_matching_node_and_match(NULL, psci_of_match, &matched_np); - if (!np || !of_device_is_available(np)) + if (!np || !of_device_is_available(np)) { + of_node_put(np); return -ENODEV; + } init_fn = (psci_initcall_t)matched_np->data; return init_fn(np);