Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp647497imm; Thu, 5 Jul 2018 06:42:02 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf089haW9j2o4p1ip0BXEBa/4p0Ao3qBliAkdHjM4OJkOEBISsbDWPS3cmkxxroqSbYKICz X-Received: by 2002:a17:902:112b:: with SMTP id d40-v6mr6318630pla.123.1530798122091; Thu, 05 Jul 2018 06:42:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530798122; cv=none; d=google.com; s=arc-20160816; b=a2N3ZZYtzYoPsLrJy3R1P+UWL0io8ftfSYMrbFJphx+wU0jWoJ+1u3gyKtVf5agVAT JBnMmRhJK9uuVmjk30NEQ/5iUNum4kTiL6f7fQx86nO2J+RF13BxADj5QLZBDwqyMSYo Z27CMoZsURwaA/b+NXpAYF7nT/xXCUhMeDhKH/UUu8aPU9kcRkT7dUv/Y21ybbq5ynoT F/teGsOTHY8+c2QVqOZpSFPNT0Lm3Y/b40LzpqCa2ep4rrIjxGb+i+jE0kaU9rBayPlx QDfyRzisRVCCMbpbOubJR2DGPXCrSOvgXVsghHpf8uk/FCSh47MHYknmAvltt0ME+hC8 s+EA== 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=c2j0Ar+sGRnQhZ84qnrq+W6V1tYFnJXzqZAsdrhPFQc=; b=0U+xlnsgTA8t38vmCQuUcHdJ/ztCQDJA9canrjW1uqTdgKDHwtcF1SWwo6otrExKAP GowLkW8V5Wzo4di4ZTVvZbBurqoHj6Q1qO5+fgfHSqUYjixCKer3CKfwpFZdaI6NnE9L 6NAhcwgSwJfbgt4t9GIm0lbIm3FE5JtMQGketair1vEdplpGSPIuRwD8q6Wd/0teUgKZ NOcsrGbSz1ih1FodZDYcch86dnGOXIVdc6uuvWz/FcPp283MnzbJGQhzRRTgl+t4wHML KDOncLxz3rl0OcgbajECsn3A7v3/MkWud5vfPLM7YImS7f2RHFab3iLu3Gpu7wEPwwHM YuSA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q14-v6si5905060pgm.512.2018.07.05.06.41.48; Thu, 05 Jul 2018 06:42:02 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754499AbeGENlO (ORCPT + 99 others); Thu, 5 Jul 2018 09:41:14 -0400 Received: from ns.mm-sol.com ([37.157.136.199]:41286 "EHLO extserv.mm-sol.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753566AbeGENdU (ORCPT ); Thu, 5 Jul 2018 09:33:20 -0400 Received: from mms-0439.qualcomm.mm-sol.com (unknown [37.157.136.206]) by extserv.mm-sol.com (Postfix) with ESMTPSA id 0FEDECD4E; Thu, 5 Jul 2018 16:33:17 +0300 (EEST) From: Todor Tomov To: mchehab@kernel.org, sakari.ailus@linux.intel.com, hans.verkuil@cisco.com, laurent.pinchart+renesas@ideasonboard.com, linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Todor Tomov Subject: [PATCH v2 06/34] media: camss: Fix OF node usage Date: Thu, 5 Jul 2018 16:32:37 +0300 Message-Id: <1530797585-8555-7-git-send-email-todor.tomov@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530797585-8555-1-git-send-email-todor.tomov@linaro.org> References: <1530797585-8555-1-git-send-email-todor.tomov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org of_graph_get_next_endpoint increases the refcount of the returned node and decreases the refcount of the passed node. Take this into account and use of_node_put properly. Signed-off-by: Todor Tomov --- drivers/media/platform/qcom/camss/camss.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index 45285eb..abf6184 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -296,6 +296,7 @@ static int camss_of_parse_ports(struct device *dev, if (of_device_is_available(node)) notifier->num_subdevs++; + of_node_put(node); size = sizeof(*notifier->subdevs) * notifier->num_subdevs; notifier->subdevs = devm_kzalloc(dev, size, GFP_KERNEL); if (!notifier->subdevs) { @@ -326,16 +327,16 @@ static int camss_of_parse_ports(struct device *dev, } remote = of_graph_get_remote_port_parent(node); - of_node_put(node); - if (!remote) { dev_err(dev, "Cannot get remote parent\n"); + of_node_put(node); return -EINVAL; } csd->asd.match_type = V4L2_ASYNC_MATCH_FWNODE; csd->asd.match.fwnode = of_fwnode_handle(remote); } + of_node_put(node); return notifier->num_subdevs; } -- 2.7.4