Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp600531imm; Fri, 1 Jun 2018 06:33:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIcXtLwm750WqYrkcxCMr0vw2p3XYTCAEKTpP/UdqnH1DrNQi+C9kq7vm0XHYzefhNf2Oor X-Received: by 2002:a17:902:4c88:: with SMTP id b8-v6mr11006450ple.285.1527860010994; Fri, 01 Jun 2018 06:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527860010; cv=none; d=google.com; s=arc-20160816; b=DnjFpX+btO0xFe5N+Yo/glxa2zJLCZY128eNsHC8fOOyyExHFlZNVlVk1nlZ8zAihl ZdE/3ZfvBT2GoOzg25Fd2q2pYhr3v0ElSRM7ce+swBSkT3T4ODqatTMJJy89yNuCSA8Q VCEZHOird6cfH4nA9MWmDIGD65L9h01ypOJSYIzsuSd3Nzzq7dCgVZImjwuzdvTqboA4 WPNQ1ThcRU6VOwb2F+F+CHMi5hinj2yi8e5n74aEZDSseX1+PaDNCw+gHfbDHeG1pJps cb0i706+VeaQJjhPTy3M0hC/wK24PLRDquA4O4HYqrjoj4ydL1rIOKrh88FKmfVHhEyC uN+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=SL9skKvUiptGki/2JTcOKDtGWVYg5+fnXLQOVZqkrW4=; b=qHyyR4Dpy3Ck6ilC+SxMO3Vt0udKLfaGI1gdUjhLOzNey6NEaqj1CGMIXdcGq9g/jd ldqycEk52nN07WOMh3cA4d953m/vM1bhbVKpXcHd0m3EZEcEcVdCGkxOHuQBEp7TYVFq AgIdoTEGWAF8qjtARqbNiLqFPXDhqTfBbfu5Bwp8gae6Akks7U2xlPJ7/bi7TbbSlr9f 5GbVn4UvSt4qddEDB/V1ZdzlWYmxPfXD7YY/yHK1pGFrBe7G/CmQX9KaGwKZDEZ7+W67 +X7XaYSfIlC1f0PPorIRkLxxkDxqPouYnMSHZrAj/0TnbDSiEobjoXtMVQayAAACd/bN UIUw== 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 n79-v6si39443965pfj.152.2018.06.01.06.33.16; Fri, 01 Jun 2018 06:33:30 -0700 (PDT) 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 S1752017AbeFANbd (ORCPT + 99 others); Fri, 1 Jun 2018 09:31:33 -0400 Received: from 178.115.242.59.static.drei.at ([178.115.242.59]:53580 "EHLO mail.osadl.at" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1750852AbeFANbc (ORCPT ); Fri, 1 Jun 2018 09:31:32 -0400 Received: by mail.osadl.at (Postfix, from userid 1001) id 7269B5C0FE8; Fri, 1 Jun 2018 13:30:17 +0000 (UTC) From: Nicholas Mc Guire To: Ludovic Desroches Cc: Mauro Carvalho Chehab , Nicolas Ferre , Alexandre Belloni , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] media: atmel-isi: move of_node_put() to cover success branch as well Date: Fri, 1 Jun 2018 13:30:14 +0000 Message-Id: <1527859814-30410-1-git-send-email-hofrat@opentech.at> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nicholas Mc Guire The of_node_put() was only covering the error branch but missed the success branch so the refcount for ep which of_graph_get_remote_port_parent() incremented on success would was not being decremented. Signed-off-by: Nicholas Mc Guire --- This patch is on top of: "media: atmel-isi: drop unnecessary while loop" Patch was compile tested with: x86_64_defconfig + CONFIG_MEDIA_SUPPORT=y MEDIA_CAMERA_SUPPORT=y, CONFIG_MEDIA_CONTROLLER=y, V4L_PLATFORM_DRIVERS=y OF=y, CONFIG_COMPILE_TEST=y, CONFIG_VIDEO_ATMEL_ISI=y Compile testing atmel-isi.c shows some sparse warnings. Seems to be due to sizeof operator being applied to a union (not related to the function being changed though). Patch is against 4.17-rc7 (localversion-next is next-20180531) drivers/media/platform/atmel/atmel-isi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/atmel/atmel-isi.c b/drivers/media/platform/atmel/atmel-isi.c index 85fc7b9..e8db4df 100644 --- a/drivers/media/platform/atmel/atmel-isi.c +++ b/drivers/media/platform/atmel/atmel-isi.c @@ -1111,10 +1111,9 @@ static int isi_graph_parse(struct atmel_isi *isi, struct device_node *node) return -EINVAL; remote = of_graph_get_remote_port_parent(ep); - if (!remote) { - of_node_put(ep); + of_node_put(ep); + if (!remote) return -EINVAL; - } /* Remote node to connect */ isi->entity.node = remote; -- 2.1.4