Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5613671imm; Tue, 12 Jun 2018 10:25:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJqy4GaZ5tMxe7kyn/jzpDpFEEXUsGh/XDeinjWICJJ5AvmAjq6J7241Eoupmhx20lzwEkq X-Received: by 2002:a63:a84f:: with SMTP id i15-v6mr1129852pgp.422.1528824304134; Tue, 12 Jun 2018 10:25:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528824304; cv=none; d=google.com; s=arc-20160816; b=nbmYY0ZzO6JFDhiE5pSEGfl98xOAOf0V7KszAHAzSbNBw9FhwX8zOToD/JvbfWiNzm dNFuzQxIM3Kau7PS3erQjIn/j4IoVXQbpBtS1qVGYMiZPQIGDCjhbakOI9B3hqLPjCjo Z+NaQEQRaWxxaGX4oWKHx5Qpgth0OhZI63CyRpuPxKpS4xcEa9iDp6gccOo+UgprTVn9 1F82MMHz59U7+CuEa5HQ0jMKxjlkXKLbT/qj5EHrKLBwAX6YmnXqpJpG6vF2ssAIuIdr M+vjQQ0vHAv9M4RD43QS4s8R0jZTlkJb/4WmG0S8IjycnGwPinS/x18RIXUMR+r6Q7Z7 J1NQ== 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:arc-authentication-results; bh=m+auVhnjVMRoRIy5vZgwsHpiK6Pn4EYQy0lCuYRIjnA=; b=tYQlgbV9RrIER+EN/kEM2+lLH57/TGV5/T78GFfhLSnHzEyUFCqulsJnyGni8WLKgq bV0Bsf1LHGo+Q0dMv1pZlROnlq+1RFwcRZfNbSC41eL0L1hCmZ9xDIeTlZ6UBrXm/836 WvTBT8dhcoLatcaEwEVFot4CJXtuGRhLnH4TqsIuqxMapEJ8EgJqzFRY4QLiIEQrm6QX g2NUXPENy+1iN7JDPc42iHHS5RnBsRwju8+0rKsQha9lyM0GLk/F4Iu8kTP4ImYYbq9f YpCCeOnEed2N4PJhAfpeBR+zh6D9r5EFf+z4TBH/qEQ6pSmAKdIoJmd88zlF0fc2TZdh Hx3A== 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 l187-v6si507305pfc.87.2018.06.12.10.24.50; Tue, 12 Jun 2018 10:25:04 -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 S933660AbeFLRXg (ORCPT + 99 others); Tue, 12 Jun 2018 13:23:36 -0400 Received: from www.osadl.org ([62.245.132.105]:58253 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754209AbeFLRXf (ORCPT ); Tue, 12 Jun 2018 13:23:35 -0400 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59] (may be forged)) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id w5CHMdrw021809; Tue, 12 Jun 2018 19:22:46 +0200 From: Nicholas Mc Guire To: Mauro Carvalho Chehab Cc: Maxime Coquelin , Alexandre Torgue , Hans Verkuil , Hugues Fruchet , Philipp Zabel , Niklas Soderlund , Benjamin Gaignard , "Gustavo A. R. Silva" , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH 2/2] media: stm32-dcmi: add mandatory of_node_put() in success path Date: Tue, 12 Jun 2018 19:22:18 +0200 Message-Id: <1528824138-19089-2-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1528824138-19089-1-git-send-email-hofrat@osadl.org> References: <1528824138-19089-1-git-send-email-hofrat@osadl.org> X-Spam-Status: No, score=0.4 required=6.0 tests=BAYES_00,DATE_IN_FUTURE_96_Q autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.osadl.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The endpoint allocated by of_graph_get_next_endpoint() needs an of_node_put() in both error and success path. As ep is not used the refcount decrement can be right after the last use of ep. Signed-off-by: Nicholas Mc Guire Fixes: commit 37404f91ef8b ("[media] stm32-dcmi: STM32 DCMI camera interface driver") --- Problem located with an experimental coccinelle script Patch was compile tested with: x86_64_defconfig, MEDIA_SUPPORT=y MEDIA_CAMERA_SUPPORT=y, V4L_PLATFORM_DRIVERS=y, OF=y, COMPILE_TEST=y CONFIG_VIDEO_STM32_DCMI=y (There are a number of sparse warnings - not related to the changes though) Patch is on top of "[PATCH 1/2] media: stm32-dcmi: drop unneceeary while(1) loop" against 4.17.0 (localversion-next is next-20180608) drivers/media/platform/stm32/stm32-dcmi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c index 70b81d2..542d148 100644 --- a/drivers/media/platform/stm32/stm32-dcmi.c +++ b/drivers/media/platform/stm32/stm32-dcmi.c @@ -1610,10 +1610,9 @@ static int dcmi_graph_parse(struct stm32_dcmi *dcmi, 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 */ dcmi->entity.node = remote; -- 2.1.4