All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yu Kuai <yukuai3@huawei.com>
To: <rick.chang@mediatek.com>, <bin.liu@mediatek.com>,
	<mchehab@kernel.org>, <matthias.bgg@gmail.com>,
	<tiffany.lin@mediatek.com>, <andrew-ct.chen@mediatek.com>,
	<xia.jiang@mediatek.com>, <hverkuil-cisco@xs4all.nl>,
	<tfiga@chromium.org>, <minghsiu.tsai@mediatek.com>,
	<jcliang@chromium.org>
Cc: <linux-media@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <yukuai3@huawei.com>,
	<yi.zhang@huawei.com>
Subject: [patch V3 3/6] media: mtk-vcodec: add missing put_device() call in mtk_vcodec_init_dec_pm()
Date: Wed, 4 Nov 2020 20:41:37 +0800	[thread overview]
Message-ID: <20201104124140.3443309-4-yukuai3@huawei.com> (raw)
In-Reply-To: <20201104124140.3443309-1-yukuai3@huawei.com>

if of_find_device_by_node() succeed, mtk_vcodec_init_dec_pm() doesn't have
a corresponding put_device(). Thus add jump target to fix the exception
handling for this function implementation.

Fixes: 590577a4e525 ("[media] vcodec: mediatek: Add Mediatek V4L2 Video Decoder Driver")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c    | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
index 36dfe3fc056a..f6a6b42865fb 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
@@ -47,11 +47,14 @@ int mtk_vcodec_init_dec_pm(struct mtk_vcodec_dev *mtkdev)
 		dec_clk->clk_info = devm_kcalloc(&pdev->dev,
 			dec_clk->clk_num, sizeof(*clk_info),
 			GFP_KERNEL);
-		if (!dec_clk->clk_info)
-			return -ENOMEM;
+		if (!dec_clk->clk_info) {
+			ret = -ENOMEM;
+			goto put_device;
+		}
 	} else {
 		mtk_v4l2_err("Failed to get vdec clock count");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto put_device;
 	}
 
 	for (i = 0; i < dec_clk->clk_num; i++) {
@@ -60,19 +63,22 @@ int mtk_vcodec_init_dec_pm(struct mtk_vcodec_dev *mtkdev)
 			"clock-names", i, &clk_info->clk_name);
 		if (ret) {
 			mtk_v4l2_err("Failed to get clock name id = %d", i);
-			return ret;
+			goto put_device;
 		}
 		clk_info->vcodec_clk = devm_clk_get(&pdev->dev,
 			clk_info->clk_name);
 		if (IS_ERR(clk_info->vcodec_clk)) {
 			mtk_v4l2_err("devm_clk_get (%d)%s fail", i,
 				clk_info->clk_name);
-			return PTR_ERR(clk_info->vcodec_clk);
+			ret = PTR_ERR(clk_info->vcodec_clk);
+			goto put_device;
 		}
 	}
 
 	pm_runtime_enable(&pdev->dev);
-
+	return 0;
+put_device:
+	put_device(pm->larbvdec);
 	return ret;
 }
 
-- 
2.25.4


WARNING: multiple messages have this Message-ID (diff)
From: Yu Kuai <yukuai3@huawei.com>
To: <rick.chang@mediatek.com>, <bin.liu@mediatek.com>,
	<mchehab@kernel.org>, <matthias.bgg@gmail.com>,
	<tiffany.lin@mediatek.com>, <andrew-ct.chen@mediatek.com>,
	<xia.jiang@mediatek.com>, <hverkuil-cisco@xs4all.nl>,
	<tfiga@chromium.org>, <minghsiu.tsai@mediatek.com>,
	<jcliang@chromium.org>
Cc: yi.zhang@huawei.com, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org, yukuai3@huawei.com,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org
Subject: [patch V3 3/6] media: mtk-vcodec: add missing put_device() call in mtk_vcodec_init_dec_pm()
Date: Wed, 4 Nov 2020 20:41:37 +0800	[thread overview]
Message-ID: <20201104124140.3443309-4-yukuai3@huawei.com> (raw)
In-Reply-To: <20201104124140.3443309-1-yukuai3@huawei.com>

if of_find_device_by_node() succeed, mtk_vcodec_init_dec_pm() doesn't have
a corresponding put_device(). Thus add jump target to fix the exception
handling for this function implementation.

Fixes: 590577a4e525 ("[media] vcodec: mediatek: Add Mediatek V4L2 Video Decoder Driver")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c    | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
index 36dfe3fc056a..f6a6b42865fb 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
@@ -47,11 +47,14 @@ int mtk_vcodec_init_dec_pm(struct mtk_vcodec_dev *mtkdev)
 		dec_clk->clk_info = devm_kcalloc(&pdev->dev,
 			dec_clk->clk_num, sizeof(*clk_info),
 			GFP_KERNEL);
-		if (!dec_clk->clk_info)
-			return -ENOMEM;
+		if (!dec_clk->clk_info) {
+			ret = -ENOMEM;
+			goto put_device;
+		}
 	} else {
 		mtk_v4l2_err("Failed to get vdec clock count");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto put_device;
 	}
 
 	for (i = 0; i < dec_clk->clk_num; i++) {
@@ -60,19 +63,22 @@ int mtk_vcodec_init_dec_pm(struct mtk_vcodec_dev *mtkdev)
 			"clock-names", i, &clk_info->clk_name);
 		if (ret) {
 			mtk_v4l2_err("Failed to get clock name id = %d", i);
-			return ret;
+			goto put_device;
 		}
 		clk_info->vcodec_clk = devm_clk_get(&pdev->dev,
 			clk_info->clk_name);
 		if (IS_ERR(clk_info->vcodec_clk)) {
 			mtk_v4l2_err("devm_clk_get (%d)%s fail", i,
 				clk_info->clk_name);
-			return PTR_ERR(clk_info->vcodec_clk);
+			ret = PTR_ERR(clk_info->vcodec_clk);
+			goto put_device;
 		}
 	}
 
 	pm_runtime_enable(&pdev->dev);
-
+	return 0;
+put_device:
+	put_device(pm->larbvdec);
 	return ret;
 }
 
-- 
2.25.4


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Yu Kuai <yukuai3@huawei.com>
To: <rick.chang@mediatek.com>, <bin.liu@mediatek.com>,
	<mchehab@kernel.org>, <matthias.bgg@gmail.com>,
	<tiffany.lin@mediatek.com>, <andrew-ct.chen@mediatek.com>,
	<xia.jiang@mediatek.com>, <hverkuil-cisco@xs4all.nl>,
	<tfiga@chromium.org>, <minghsiu.tsai@mediatek.com>,
	<jcliang@chromium.org>
Cc: yi.zhang@huawei.com, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org, yukuai3@huawei.com,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org
Subject: [patch V3 3/6] media: mtk-vcodec: add missing put_device() call in mtk_vcodec_init_dec_pm()
Date: Wed, 4 Nov 2020 20:41:37 +0800	[thread overview]
Message-ID: <20201104124140.3443309-4-yukuai3@huawei.com> (raw)
In-Reply-To: <20201104124140.3443309-1-yukuai3@huawei.com>

if of_find_device_by_node() succeed, mtk_vcodec_init_dec_pm() doesn't have
a corresponding put_device(). Thus add jump target to fix the exception
handling for this function implementation.

Fixes: 590577a4e525 ("[media] vcodec: mediatek: Add Mediatek V4L2 Video Decoder Driver")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c    | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
index 36dfe3fc056a..f6a6b42865fb 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
@@ -47,11 +47,14 @@ int mtk_vcodec_init_dec_pm(struct mtk_vcodec_dev *mtkdev)
 		dec_clk->clk_info = devm_kcalloc(&pdev->dev,
 			dec_clk->clk_num, sizeof(*clk_info),
 			GFP_KERNEL);
-		if (!dec_clk->clk_info)
-			return -ENOMEM;
+		if (!dec_clk->clk_info) {
+			ret = -ENOMEM;
+			goto put_device;
+		}
 	} else {
 		mtk_v4l2_err("Failed to get vdec clock count");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto put_device;
 	}
 
 	for (i = 0; i < dec_clk->clk_num; i++) {
@@ -60,19 +63,22 @@ int mtk_vcodec_init_dec_pm(struct mtk_vcodec_dev *mtkdev)
 			"clock-names", i, &clk_info->clk_name);
 		if (ret) {
 			mtk_v4l2_err("Failed to get clock name id = %d", i);
-			return ret;
+			goto put_device;
 		}
 		clk_info->vcodec_clk = devm_clk_get(&pdev->dev,
 			clk_info->clk_name);
 		if (IS_ERR(clk_info->vcodec_clk)) {
 			mtk_v4l2_err("devm_clk_get (%d)%s fail", i,
 				clk_info->clk_name);
-			return PTR_ERR(clk_info->vcodec_clk);
+			ret = PTR_ERR(clk_info->vcodec_clk);
+			goto put_device;
 		}
 	}
 
 	pm_runtime_enable(&pdev->dev);
-
+	return 0;
+put_device:
+	put_device(pm->larbvdec);
 	return ret;
 }
 
-- 
2.25.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-11-04 12:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04 12:41 [patch V3 0/6] patches to add missing put_device() call Yu Kuai
2020-11-04 12:41 ` Yu Kuai
2020-11-04 12:41 ` Yu Kuai
2020-11-04 12:41 ` [patch V3 1/6] media: platform: add missing put_device() call in mtk_jpeg_clk_init() Yu Kuai
2020-11-04 12:41   ` Yu Kuai
2020-11-04 12:41   ` Yu Kuai
2020-11-04 12:41 ` [patch V3 2/6] media: platform: add missing put_device() call in mtk_jpeg_probe() and mtk_jpeg_remove() Yu Kuai
2020-11-04 12:41   ` Yu Kuai
2020-11-04 12:41   ` Yu Kuai
2020-11-04 12:41 ` Yu Kuai [this message]
2020-11-04 12:41   ` [patch V3 3/6] media: mtk-vcodec: add missing put_device() call in mtk_vcodec_init_dec_pm() Yu Kuai
2020-11-04 12:41   ` Yu Kuai
2020-11-04 12:41 ` [patch V3 4/6] media: mtk-vcodec: add missing put_device() call in mtk_vcodec_release_dec_pm() Yu Kuai
2020-11-04 12:41   ` Yu Kuai
2020-11-04 12:41   ` Yu Kuai
2020-11-04 12:41 ` [patch V3 5/6] media: mtk-vcodec: add missing put_device() call in mtk_vcodec_init_enc_pm() Yu Kuai
2020-11-04 12:41   ` Yu Kuai
2020-11-04 12:41   ` Yu Kuai
2020-11-04 12:41 ` [patch V3 6/6] media: mtk-vcodec: add missing put_device() call in mtk_vcodec_release_enc_pm() Yu Kuai
2020-11-04 12:41   ` Yu Kuai
2020-11-04 12:41   ` Yu Kuai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201104124140.3443309-4-yukuai3@huawei.com \
    --to=yukuai3@huawei.com \
    --cc=andrew-ct.chen@mediatek.com \
    --cc=bin.liu@mediatek.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jcliang@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=minghsiu.tsai@mediatek.com \
    --cc=rick.chang@mediatek.com \
    --cc=tfiga@chromium.org \
    --cc=tiffany.lin@mediatek.com \
    --cc=xia.jiang@mediatek.com \
    --cc=yi.zhang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.