Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3626792imu; Mon, 28 Jan 2019 08:04:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN73GVD6o3+3/5i2sNxi/yRFNcRC+HBjCckVfYniuOdXrYqfiHax6KedkJwgR2q05rC51IOW X-Received: by 2002:a63:83:: with SMTP id 125mr19915150pga.343.1548691472855; Mon, 28 Jan 2019 08:04:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548691472; cv=none; d=google.com; s=arc-20160816; b=vgl+CUtCT650tvxXgpCjt3SWuETTNe1kayCyKD7vZYO6UM+BuPixm+kOhttRDxwdoM IexWqoe588H6bfXwxl0d6CvDF1QGAaJHpjxhlyA+wLWGslBAY+e46FNGEnuBehwuzW94 /JVnLQ17eTfhxbaxAV3Y8t/RywAFOtpMaeQVlx1yV4Z1j6YUiK16jy/RX06bOKopdnnh xVYyPFWc8lrwL3WDL/J72aSpblKeVrT+AxqzWxb9QBJ+mbNJ/90P+vzdDF2DnKM1TBrz biztILTSa7cZjWbLL1es2DqqlqJ36/FjGLN6WpORHzGEvHnmfQoCDO8dMjkoAeCCG80z kFCg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZDwj7w4xRnm99qQa83s+cpabbDqgeWQuQsYuBKcBlh0=; b=u6Zh0BZo0amhAcyc1I5JoEpmXe+SXjbEfgX9EO6MijohllUmGAc/UG+dzY+WJypLnG 57k0BvarqB5BETjQ86M7r31WYrUU0na20buqWBLOzZu7iKVqSq9qAqbIRo1kceH9dYqk 9VapcPiOHnx9vvGeDFq8bgVPafhh2XJJ7f/+gpgSgNaEkk5ZH723NViehZ+0WiZhd7mu 9bsUsyqXL7gugdeH4vf/2sK/oCBYDAxCcrcVcvRd9Cacm1bpiuwmP3m9eOUlwqlxfmCu d2ZyO799x1xVlFwwGPhU/mYQkz3Q4zV/qp78bLfy0Zx2Y7BNL8usL7gh58anxVxg8YfF 3MAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rUcCFGV9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j5si34040654pfg.254.2019.01.28.08.04.16; Mon, 28 Jan 2019 08:04:32 -0800 (PST) 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=rUcCFGV9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731184AbfA1QCD (ORCPT + 99 others); Mon, 28 Jan 2019 11:02:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:47210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731159AbfA1QCA (ORCPT ); Mon, 28 Jan 2019 11:02:00 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 657DA2175B; Mon, 28 Jan 2019 16:01:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691319; bh=khEciF1J8C5dG2EQcIl21l4X5RDmspjmIGFXJSMYwDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rUcCFGV9a3p+Xnr5bP8DJu7ie6S1moD59y0rKJvQ2ixHQ7GhsLwejewVTN0SFREQv MhpDLUMD2hkz2xR0EooLyCcgJiT90XRYovPDd0TI2Qu2kKzQZwkmDYviuPcUxR+NOT l4gTKcHdhK/l0HDjeoinZ4cYICEUv6UmGM6hVvqc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alexey Khoroshilov , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin , linux-media@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 057/258] media: mtk-vcodec: Release device nodes in mtk_vcodec_init_enc_pm() Date: Mon, 28 Jan 2019 10:56:03 -0500 Message-Id: <20190128155924.51521-57-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexey Khoroshilov [ Upstream commit 8ea0f2ba0fa3f91ea1b8d823a54b042026ada6b3 ] of_parse_phandle() returns the device node with refcount incremented. There are two nodes that are used temporary in mtk_vcodec_init_enc_pm(), but their refcounts are not decremented. The patch adds one of_node_put() and fixes returning error codes. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c index 3e73e9db781f..7c025045ea90 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c @@ -41,25 +41,27 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev) node = of_parse_phandle(dev->of_node, "mediatek,larb", 0); if (!node) { mtk_v4l2_err("no mediatek,larb found"); - return -1; + return -ENODEV; } pdev = of_find_device_by_node(node); + of_node_put(node); if (!pdev) { mtk_v4l2_err("no mediatek,larb device found"); - return -1; + return -ENODEV; } pm->larbvenc = &pdev->dev; node = of_parse_phandle(dev->of_node, "mediatek,larb", 1); if (!node) { mtk_v4l2_err("no mediatek,larb found"); - return -1; + return -ENODEV; } pdev = of_find_device_by_node(node); + of_node_put(node); if (!pdev) { mtk_v4l2_err("no mediatek,larb device found"); - return -1; + return -ENODEV; } pm->larbvenclt = &pdev->dev; -- 2.19.1