Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1001004imm; Wed, 25 Jul 2018 09:44:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf+023DP9ObiwPSZ1zuef7Rj7BZCmfnp4om3JwUjqMEha6EV21JwD6STKqWYN58NBoj9FCQ X-Received: by 2002:a63:551e:: with SMTP id j30-v6mr20510434pgb.92.1532537063613; Wed, 25 Jul 2018 09:44:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532537063; cv=none; d=google.com; s=arc-20160816; b=CK4tc5+Usc+rk6A/tQniiHjghOI1qKltWV1OQOSyngsJibLBBvmFWLOCs4YKMzZz9Z Au00o9qxMssAaEwLO7Pgps19hSLFWOe3p+myBpNM8Dl39vu9ahg8NIM0LDQDOfn6hZaN Du8N4V7fd9uGNhFDp3mR175EfhWDkjyBE764v7yTY9y+Hv65IAhf236kQLw91kKe5u7T IghNfLr6x9kPPjYfk8Gkz/qpvIyi5+Z9iqNBvSPuNr/5DEdla/mSybzGfdZzyvpWf9Hd 529mPSvZ4q2ERtK8Jp2h72qXzlPq/l6PUCwM9UJZuA4SBdBtWJuXpXN2vM8bfSFm++2p JWbw== 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=k7FHyClPbHDhTBGtIbC7MJIdB1OqxvWgY5HJFGqshDZGtWmRo9nQNruOZMxgqImUZR Bd2XNV2K5SgK43UQwKlFJEtz9K88Dmu4E0qumBGgnlIeGAnLTfLeXAay8kcy1xBzYbr6 hONwPEdHulC/Dmi2JzEisA/BzEYxQsAItjparEiNHACN6cZ7DpmvB1pKK4+dK6XRsYGQ 00RABcSDFs0QDBq1TT84EbFXc4NQdEWqNWpIO/aj7/1XHRo3woX5wmvnDbEAt7atW71Q gG27dWiFugoEAah41dfuxRIrLq/msu7u1gqYAbh4zbWoOJx0Y5yq+yUikcOeNBd53g0m WsXg== 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 o16-v6si12385700pgv.402.2018.07.25.09.44.08; Wed, 25 Jul 2018 09:44:23 -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 S1731301AbeGYRzE (ORCPT + 99 others); Wed, 25 Jul 2018 13:55:04 -0400 Received: from ns.mm-sol.com ([37.157.136.199]:35576 "EHLO extserv.mm-sol.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729121AbeGYRvX (ORCPT ); Wed, 25 Jul 2018 13:51:23 -0400 Received: from mms-0439.qualcomm.mm-sol.com (unknown [37.157.136.206]) by extserv.mm-sol.com (Postfix) with ESMTPSA id DA403CD58; Wed, 25 Jul 2018 19:38:53 +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 v4 06/34] media: camss: Fix OF node usage Date: Wed, 25 Jul 2018 19:38:15 +0300 Message-Id: <1532536723-19062-7-git-send-email-todor.tomov@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532536723-19062-1-git-send-email-todor.tomov@linaro.org> References: <1532536723-19062-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