From patchwork Sun Jan 24 16:32:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitoj Kaur Chawla X-Patchwork-Id: 572333 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0FC22140BF7 for ; Mon, 25 Jan 2016 03:32:17 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=adSya3r4; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752149AbcAXQcP (ORCPT ); Sun, 24 Jan 2016 11:32:15 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35869 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751608AbcAXQcP (ORCPT ); Sun, 24 Jan 2016 11:32:15 -0500 Received: by mail-pf0-f193.google.com with SMTP id n128so5718108pfn.3; Sun, 24 Jan 2016 08:32:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=OIwf6ytxqaVsPen+aK2K0BIfdkSSxw3L+DQ+4zsfTaU=; b=adSya3r4m6l14LBeKgoqB5nffppvYNeNRXcAYIH65LAFAdBrhGiYLRcpJ9dAL4hBFN 0JHa3jOWxuldNegGyTfDbPrFvXdWy9IXjr6zjsHKPivaTlUy1gtEL+DQ6O7HSju3vvro m5Chg/op+L4cNhbUFLlEWaUSZ95VNWie3aH2on6uK+DoT+nZvVvQYTgI1ZGQcWWTxuAi /ZxphIX310okdOEWMiG1B8aaPeTM1KWLGz7B7uPqRd3MYysyXEnKS9vFFQDIBrlR82hQ xfPaQpnWF/MRyGU89NspXJU8Gyt00+7pAvV87eE8pzXHcq90Q5qacvZWT81FJW2xGREh +GBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=OIwf6ytxqaVsPen+aK2K0BIfdkSSxw3L+DQ+4zsfTaU=; b=MiV6FPfX+eXPJAuZPiH3qnMRDjZ0S1XQboa1cWIKfecB7Jx0VezMy9/vu+qmNmRmT1 n43ERXnuHjfRWUSrzF0iSK+47cbJzpvO0gpdb8nopxTRbSQ/qFOLKQx7/i4ngIv/wPsZ eVVMSgV9O6KzpkFOy+0yGXC2oPE0krKj/Tl/jwLy+xYmx833QsLHVK71Mb2xaAx3XqL7 VRhX3ijfZD3JdBmSrrGWoRzXDROWP/KbAVnGovAn9V2tjaF8jdxqBt7xxDHOZJMg+lZP V9WpKCKXsvXKi+O28Lp4n4zpchBFUUuBcQRcnxU8Qti8WC5nhurXNPxqynqxOV2Wdmbk woKg== X-Gm-Message-State: AG10YORAeVEnz8tkpOGVzvNCcoqmejPdSZKK2me7oTgYPAZW0U+LXiLpy4/Sd/xHKfLrww== X-Received: by 10.98.42.81 with SMTP id q78mr19478714pfq.142.1453653134480; Sun, 24 Jan 2016 08:32:14 -0800 (PST) Received: from localhost ([110.227.143.170]) by smtp.gmail.com with ESMTPSA id dg1sm22690427pad.18.2016.01.24.08.32.13 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sun, 24 Jan 2016 08:32:13 -0800 (PST) Date: Sun, 24 Jan 2016 22:02:10 +0530 From: Amitoj Kaur Chawla To: thierry.reding@gmail.com, tbergstrom@nvidia.com, dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Cc: julia.lawall@lip6.fr Subject: [PATCH] gpu: host1x: bus: Add missing of_node_put Message-ID: <20160124163210.GA24872@amitoj-Inspiron-3542> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org for_each_child_of_node performs an of_node_get on each iteration, so to break out of the loop an of_node_put is required. Found using Coccinelle. The semantic patch used for this is as follows: // @@ expression e; local idexpression n; @@ for_each_child_of_node(..., n) { ... when != of_node_put(n) when != e = n ( return n; | + of_node_put(n); ? return ...; ) ... } // Signed-off-by: Amitoj Kaur Chawla --- drivers/gpu/host1x/bus.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c index 4a99c64..c1795a2 100644 --- a/drivers/gpu/host1x/bus.c +++ b/drivers/gpu/host1x/bus.c @@ -82,8 +82,10 @@ static int host1x_device_parse_dt(struct host1x_device *device, if (of_match_node(driver->subdevs, np) && of_device_is_available(np)) { err = host1x_subdev_add(device, np); - if (err < 0) + if (err < 0) { + of_node_put(np); return err; + } } }