Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp2551395imc; Sat, 23 Feb 2019 05:59:27 -0800 (PST) X-Google-Smtp-Source: AHgI3IYircgghqex+1tDQAFsW5v9FrKqazlZhRc+6ecJyPd/Q7kFJ045Uc6zXsdozSTKT7YxWroI X-Received: by 2002:a63:2586:: with SMTP id l128mr9093563pgl.104.1550930367213; Sat, 23 Feb 2019 05:59:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550930367; cv=none; d=google.com; s=arc-20160816; b=xp959MbN/+TKa9Zfp1WUGhAUbIeQD+9NZiluloMjocxMuthoHJ4yVd2ox9GwM+Qsj+ RuSeMSgNgI21dRw/1jo0d8JvlFC4dV97T2PkEsEmq9TK0o4LjC1SyTROX84vF4kAyCLT XHL3gqm23g8yNKNtwdd1kkSZIagllriYzCSTUmOpyofrLC8UdtREpRFZVqfH68FHwKoB e8EwScE+n4/yAtnHHa2WF19PeLg3FtqMElInSUIY5GxsRTzYNwHH/YJ2M+6ZNuTW2OcU Dda2Ulrl7dvFiagVKcAtcdTdEW5k7hjBrFaPmcCj9qaqYt1ZYz/SrbUZREelchoefvrd WQdA== 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=6Hcw1JC9SivUTqS3TNT9AKEIY9Q4TINLW5VsHxs/iG0=; b=Fj+xqUNbUyqGeyY2yxKdnBfFte5+bR4Ot6XGOHFqN56JZORdzlC7Z3ZzC82BFfTR/i X5i/3tyrJpYLQbFALXmvg0AzEP+12ls0PwVq61K0l6mYwo3v8La++WB676q8mdSg6+aC T8VRyEFAcY+FeoPZwnUrjEPfDPsf9+87R2SpOHLOdpaPHgazb4+an393z8bar1b2bqQV nIv8QB/DieerxGz9htPavXaMR7BPje3QJngjXzpQurmEXIq4rElqKFq1+9LBsj3MtDLV VJ0jr/2C20AXjfSbJQoGzZWjKPqXxHLsgufKko6lBT38gbQWOBBhitxzXlV8262P98D4 euIw== 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 j22si4021098pgg.463.2019.02.23.05.59.09; Sat, 23 Feb 2019 05:59:27 -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 S1727854AbfBWN6q (ORCPT + 99 others); Sat, 23 Feb 2019 08:58:46 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:17528 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725859AbfBWN6q (ORCPT ); Sat, 23 Feb 2019 08:58:46 -0500 X-IronPort-AV: E=Sophos;i="5.58,403,1544482800"; d="scan'208";a="370609500" 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:43 +0100 From: Julia Lawall To: linux-kernel@vger.kernel.org, linux@arm.linux.org.uk, robin.murphy@arm.com Cc: kernel-janitors@vger.kernel.org Subject: [PATCH 01/12] arm-cci: add missing of_node_put after of_device_is_available Date: Sat, 23 Feb 2019 14:20:32 +0100 Message-Id: <1550928043-14889-2-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: 896ddd600ba4 ("drivers: bus: check cci device tree node status") Signed-off-by: Julia Lawall --- This file doesn't seem to have a maintainer. drivers/bus/arm-cci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff -u -p a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c --- a/drivers/bus/arm-cci.c +++ b/drivers/bus/arm-cci.c @@ -538,8 +538,10 @@ static int cci_probe(void) struct resource res; np = of_find_matching_node(NULL, arm_cci_matches); - if (!of_device_is_available(np)) + if (!of_device_is_available(np)) { + of_node_put(np); return -ENODEV; + } ret = of_address_to_resource(np, 0, &res); if (!ret) {