linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Yu Kuai <yukuai3@huawei.com>,
	tiffany.lin@mediatek.com, andrew-ct.chen@mediatek.com,
	mchehab@kernel.org, matthias.bgg@gmail.com
Cc: yi.zhang@huawei.com, linux-mediatek@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH 2/3] media: mtk-vcodec: add missing put_device() call in mtk_vcodec_init_dec_pm()
Date: Sat, 3 Oct 2020 13:19:34 +0200	[thread overview]
Message-ID: <f155ec8b-9036-55b4-2624-a042b6e26866@xs4all.nl> (raw)
In-Reply-To: <20200924081802.1061024-1-yukuai3@huawei.com>

On 24/09/2020 10:18, Yu Kuai wrote:
> 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 5a6ec8fb52da..01e680ede9bd 100644
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
> @@ -48,11 +48,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++) {
> @@ -61,19 +64,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;
>  }
>  
> 

A similar question as with the previous patch: shouldn't there be a
put_device(pm->larbvdec); in the mtk_vcodec_release_dec_pm() function?

Same for the next patch.

Regards,

	Hans

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

      reply	other threads:[~2020-10-03 11:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24  8:18 [PATCH 2/3] media: mtk-vcodec: add missing put_device() call in mtk_vcodec_init_dec_pm() Yu Kuai
2020-10-03 11:19 ` Hans Verkuil [this message]

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=f155ec8b-9036-55b4-2624-a042b6e26866@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=andrew-ct.chen@mediatek.com \
    --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=tiffany.lin@mediatek.com \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).