Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp87835ybp; Thu, 3 Oct 2019 10:33:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOrsNGtcbjjhUITPVkPngxN+NOjA7VGKRuoJL5ajs2GXhDmMpZ04dG17OKWsOhuPmRXsTC X-Received: by 2002:a17:906:7802:: with SMTP id u2mr8824355ejm.3.1570124034174; Thu, 03 Oct 2019 10:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570124034; cv=none; d=google.com; s=arc-20160816; b=hiw38lD8FX3RtVqWMEEKqtWAxOPUlszTdAX73rsmeQAosrMx4Z1edrIZY3hb18k6lh q2RuLTlyb+LQmf1aReCl99YsrQZqy/UiWdfg+6P81YcBMOCLIiKJ6aRogEHSt1ZT0++3 L9Hgi8AQUsCOrkmYkxLYGEVBco9iPr9ob0/9sheNE1egl9kATg93Im3AAZlDG7g3ctF8 KaTlVcq6AZMVdbYf5xU/u4vyXgJHVjmEQ4f42vo3lZpNIznr7isti59cXMoNN5quvzny jJ6BMT2iDlS8i6IAhAz9bwW7zmvkZX3R5x5G7iEYTRPv5M0oO+MDHnjgMoUBb0ap9siI /gQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/ZG+AodOAJCX8Xw5kAgYdMD+VxjT8D0jdZNrRxaPV3w=; b=o19EX4Y/1kYlxw5BEcW73qZefg/TeBaM09dR91hupNEH3GuxJTP1hdbeMzP+km8qw8 MnMkwJ7Eb78xg4T9T1VQ54fypX1cdZ25W2CHK2z+D4E6+5ibnlEYBDbpA4igQv7rpiw9 CWR0fxAZ2vYDLLys4nPubqtJ3y+AUMs3yyLHc8x/1osBbyfDMzvp1F1ogrgh3PSZd/+H OnsLCfylVeWRwFr8dX1lSEHmgL81ukO+HUfA9rBON1nz7PnbghppZtw4SvCa0OgdQTkh vf6emQ1SafpsZdDzC+S1UMQJ1TXFDrgOSqcM7l45gj7kt128lt0mj6JYHOdEC3PPFxsd wiHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lgHi+brI; 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 v8si1607762eju.333.2019.10.03.10.33.29; Thu, 03 Oct 2019 10:33:54 -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; dkim=pass header.i=@kernel.org header.s=default header.b=lgHi+brI; 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 S2389316AbfJCQRq (ORCPT + 99 others); Thu, 3 Oct 2019 12:17:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:43714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388484AbfJCQRl (ORCPT ); Thu, 3 Oct 2019 12:17:41 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3427D215EA; Thu, 3 Oct 2019 16:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570119460; bh=9WlLpdEMTjmBcZOqESYZTnBii0ZagJO0QmItdcIX0is=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lgHi+brIpRCK24u7eoheEXK9eCbig2kYNIKo0Op1FQLV0kX4MII9rFoC1qVlytdtl yG5j4rIbk+hXOjEcRCg3dNUqDknLp1eN3Gi+9VjytGxlNARK2qK7qBK8SEuCuXk/yj b27c1o8xrgiSHQejAvVJifTqvsbDlkIeN7omdyeM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Yang , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 034/211] media: exynos4-is: fix leaked of_node references Date: Thu, 3 Oct 2019 17:51:40 +0200 Message-Id: <20191003154454.862766770@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154447.010950442@linuxfoundation.org> References: <20191003154447.010950442@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wen Yang [ Upstream commit da79bf41a4d170ca93cc8f3881a70d734a071c37 ] The call to of_get_child_by_name returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: drivers/media/platform/exynos4-is/fimc-is.c:813:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 807, but without a corresponding object release within this function. drivers/media/platform/exynos4-is/fimc-is.c:870:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 807, but without a corresponding object release within this function. drivers/media/platform/exynos4-is/fimc-is.c:885:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 807, but without a corresponding object release within this function. drivers/media/platform/exynos4-is/media-dev.c:545:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 541, but without a corresponding object release within this function. drivers/media/platform/exynos4-is/media-dev.c:528:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 499, but without a corresponding object release within this function. drivers/media/platform/exynos4-is/media-dev.c:534:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 499, but without a corresponding object release within this function. Signed-off-by: Wen Yang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/exynos4-is/fimc-is.c | 1 + drivers/media/platform/exynos4-is/media-dev.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c index 5ddb2321e9e48..0fe9be93fabe2 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.c +++ b/drivers/media/platform/exynos4-is/fimc-is.c @@ -819,6 +819,7 @@ static int fimc_is_probe(struct platform_device *pdev) return -ENODEV; is->pmu_regs = of_iomap(node, 0); + of_node_put(node); if (!is->pmu_regs) return -ENOMEM; diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c index deb499f76412a..b5993532831da 100644 --- a/drivers/media/platform/exynos4-is/media-dev.c +++ b/drivers/media/platform/exynos4-is/media-dev.c @@ -498,6 +498,7 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd) continue; ret = fimc_md_parse_port_node(fmd, port, index); + of_node_put(port); if (ret < 0) { of_node_put(node); goto rpm_put; @@ -531,6 +532,7 @@ static int __of_get_csis_id(struct device_node *np) if (!np) return -EINVAL; of_property_read_u32(np, "reg", ®); + of_node_put(np); return reg - FIMC_INPUT_MIPI_CSI2_0; } -- 2.20.1