Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp898644pxp; Wed, 16 Mar 2022 20:35:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQNEDa/7HhwPR+/WN6UAaEBow8pClrZDsifdZgd1vvXm05dfT/j8YxRrFpqkR7P0ignlaC X-Received: by 2002:a65:4605:0:b0:381:fea8:7418 with SMTP id v5-20020a654605000000b00381fea87418mr2077241pgq.454.1647488109063; Wed, 16 Mar 2022 20:35:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647488109; cv=none; d=google.com; s=arc-20160816; b=mUgZkv/UiD7i7qIoXFut4PmJAvSipR5e2GK2kRR+E1PIzc5YVKODgrUbvLW67jJV+f U019aKBNL853Em2ahBhnGivObSuTRQBXrCkOlYIqSaUx4WVWhvmt1uS0FnfIqrT1/vim dFSSCMSCYzTbe7/6MKcixuLT5uw18jN4RQbJxZaY8cXIOZvRo25t+FctwcWpQWIeWJQg CBOtqNRmRenWFteymd9jabs0Q0kO2LMFDqyaBsCRioVo2iYoHxyviww+9mqHeGhOvla1 DoqByc0+J1tW9K9UkIcoehvf1SxucbViGtOZLXhBnZZYHb4q3Imt8ux5IZM86L14Trl8 C+Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=+lwPAqRVLgFwR9AhutOq8Nk3xuuQo/OW3EQ2RnGLdjo=; b=Qi+BqvDbwOoMlNXFqtdHLGBW2kCsx1K8LvBmaPa4BmUDVuaMtWRxh6atstREATb+5D vYBeh72Lu528ns4DdnsGM5D0eWJu+SvkNvk9+F0QdxeqTvxdmB6PSxx4PVRL7MmKLGKs YIbIwU9dC7XeoeOpMMY5wTT+bqbKumlQt1Dd0t7JVaS7Zjwk1sAF84sVsPEvmVE/MoBO hCQT0dSwURLj3WKE1u3Gk9i8wYDBLKKVcDkDkUM27FzNpELzxzkztPMPD0CbZXYPvESR 4/IFuUnZkrQDOq8Wi0kqhCCIk9bNdI2eIudOkj7mBfbyuZEal2pXyenN5aSOYzGSlP43 o+yA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id bk4-20020a17090b080400b001bf6f0a73a9si6170957pjb.151.2022.03.16.20.35.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 20:35:09 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F40E34BFE0; Wed, 16 Mar 2022 20:30:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354389AbiCPIHJ (ORCPT + 99 others); Wed, 16 Mar 2022 04:07:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240102AbiCPIHH (ORCPT ); Wed, 16 Mar 2022 04:07:07 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12D3D5E773; Wed, 16 Mar 2022 01:05:54 -0700 (PDT) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KJN8B3WltzfZ6l; Wed, 16 Mar 2022 16:03:54 +0800 (CST) Received: from dggpemm500002.china.huawei.com (7.185.36.229) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 16 Mar 2022 16:05:22 +0800 Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500002.china.huawei.com (7.185.36.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 16 Mar 2022 16:05:21 +0800 From: Xiongfeng Wang To: , , , CC: , , Subject: [PATCH -next] media: amphion: Add missing of_node_put() in vpu_core_parse_dt() Date: Wed, 16 Mar 2022 16:19:38 +0800 Message-ID: <20220316081938.80819-1-wangxiongfeng2@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500002.china.huawei.com (7.185.36.229) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org of_parse_phandle() will increment the refcount of the returned device_node. Calling of_node_put() to avoid the refcount leak. Signed-off-by: Xiongfeng Wang --- drivers/media/platform/amphion/vpu_core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/platform/amphion/vpu_core.c index 016554387f3f..1da20335bc45 100644 --- a/drivers/media/platform/amphion/vpu_core.c +++ b/drivers/media/platform/amphion/vpu_core.c @@ -529,11 +529,14 @@ static int vpu_core_parse_dt(struct vpu_core *core, struct device_node *np) } if (of_address_to_resource(node, 0, &res)) { dev_err(core->dev, "boot-region of_address_to_resource error\n"); + of_node_put(node); return -EINVAL; } core->fw.phys = res.start; core->fw.length = resource_size(&res); + of_node_put(node); + node = of_parse_phandle(np, "memory-region", 1); if (!node) { dev_err(core->dev, "rpc-region of_parse_phandle error\n"); @@ -541,6 +544,7 @@ static int vpu_core_parse_dt(struct vpu_core *core, struct device_node *np) } if (of_address_to_resource(node, 0, &res)) { dev_err(core->dev, "rpc-region of_address_to_resource error\n"); + of_node_put(node); return -EINVAL; } core->rpc.phys = res.start; @@ -549,6 +553,7 @@ static int vpu_core_parse_dt(struct vpu_core *core, struct device_node *np) if (core->rpc.length < core->res->rpc_size + core->res->fwlog_size) { dev_err(core->dev, "the rpc-region <%pad, 0x%x> is not enough\n", &core->rpc.phys, core->rpc.length); + of_node_put(node); return -EINVAL; } @@ -560,6 +565,7 @@ static int vpu_core_parse_dt(struct vpu_core *core, struct device_node *np) if (ret != VPU_CORE_MEMORY_UNCACHED) { dev_err(core->dev, "rpc region<%pad, 0x%x> isn't uncached\n", &core->rpc.phys, core->rpc.length); + of_node_put(node); return -EINVAL; } @@ -571,6 +577,8 @@ static int vpu_core_parse_dt(struct vpu_core *core, struct device_node *np) core->act.length = core->rpc.length - core->res->rpc_size - core->log.length; core->rpc.length = core->res->rpc_size; + of_node_put(node); + return 0; } -- 2.20.1