From patchwork Mon Jul 23 11:02:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todor Tomov X-Patchwork-Id: 142568 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5909303ljj; Mon, 23 Jul 2018 04:04:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfWzCxR8VTN606yT/zRx7XCAJgdRGzpGSxDuQb8Iy8RP2YE6rxkzqTZ5F0IeZKhMy0HFh0M X-Received: by 2002:a62:c505:: with SMTP id j5-v6mr12498901pfg.153.1532343850041; Mon, 23 Jul 2018 04:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532343850; cv=none; d=google.com; s=arc-20160816; b=BEVXEzjFSMRkeHcn/4qi+ouKUj10rSrOKGJa4zH6eRd5Vf5Y8A2geqCH439FFGXwm7 mrsYvhbpqFFoitXwGipveyg/hC3+5IWf3yNNf/OqZT21g0nJVm9DeC0Vvj+X6B6BA6v+ jMT90+h2dlSWotJqxsjoKp9RefHpLEhPMNADO3Bhp3/T2tQB2M3eOVMiHV1r2nMPTGfM l6cPGa5jKAdZI+NmuqmVw2Ln2p234/NKf8v/nnONCgoTWa0xDP3MB4i85qHCaaYLhp+a c8BBgCLZyek53zEQcIH9rpOoJ1Ez+b0QrQ4hrpB+OGSFX++p0DCdiDbWTkgnvME65uM2 2q0Q== 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=kwSw/EFDjWroH1tctrdFSVcseQCpsB6+KKXMn+YXGqtG+XQJoEhCh6auJjKuJRa0P/ PR+0lJ6lV5nVU1jf/QePeYzK+rHYVhp30lc1XoMCtMlXCo075NRdNqMD++oAwvuZgBfK SrzIjaNO+0eDhAz4v6GUcK2bGRkSU2RdAGorwLucZVWpuJJCDqffM1CE/L++NIh9cD1m GzbJYF3oXNLPxkRGDTA3Y4H2dmUL1i0IsnenBCGC9WbUKb/A7HnxZRzbO34REAajDaDH fcv9cGKyWlbf4MfUh+lxdU3LIjVAjXLiJkF4uNa3oVLcUGATQFCxB29NKgjBVoiXFLhP OZdg== 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 f62-v6si9009071pfa.73.2018.07.23.04.04.09; Mon, 23 Jul 2018 04:04:10 -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 S2388109AbeGWMEp (ORCPT + 31 others); Mon, 23 Jul 2018 08:04:45 -0400 Received: from ns.mm-sol.com ([37.157.136.199]:39899 "EHLO extserv.mm-sol.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388004AbeGWMEo (ORCPT ); Mon, 23 Jul 2018 08:04:44 -0400 Received: from mms-0439.qualcomm.mm-sol.com (unknown [37.157.136.206]) by extserv.mm-sol.com (Postfix) with ESMTPSA id 57B7CCD55; Mon, 23 Jul 2018 14:04:02 +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 v3 06/35] media: camss: Fix OF node usage Date: Mon, 23 Jul 2018 14:02:23 +0300 Message-Id: <1532343772-27382-7-git-send-email-todor.tomov@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532343772-27382-1-git-send-email-todor.tomov@linaro.org> References: <1532343772-27382-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(-) -- 2.7.4 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; }