Re: [PATCH 2/3] drm:msm: Initial Add Writeback Support

From: Emil Velikov
Date: Thu Apr 02 2015 - 18:31:11 EST


On 2 April 2015 at 19:07, <jilaiw@xxxxxxxxxxxxxx> wrote:
> Thanks Emil. Please check the comments embedded and for the rest I will
> update the code.
>
>> Hi Jilai,
>>
>> Just a few questions, not really a review as I'm not that familiar
>> with the code.
>>
>>
>>> +++ b/drivers/gpu/drm/msm/Kconfig
>>> @@ -27,6 +27,16 @@ config DRM_MSM_FBDEV
>>> support. Note that this support also provide the linux console
>>> support on top of the MSM modesetting driver.
>>>
>>> +config DRM_MSM_WB
>>> + bool "Enable writeback support for MSM modesetting driver"
>>> + depends on DRM_MSM
>>> + depends on VIDEO_V4L2
>>> + select VIDEOBUF2_CORE
>>> + default y
>>> + help
>>> + Choose this option if you have a need to support writeback
>>> + connector.
>>> +
>> Is it worth mentioning which devices/SoCs have such connector ?
> If the devices have WB connector, it will be added in the device tree.
>
I was thinking more about listing a one or two SoCs so that one gets
the general idea. Although it might end up more confusing than helpful
as more devices become available. Suggestion withdrawn.


>>> +static struct msm_wb *msm_wb_init(struct platform_device *pdev)
>>> +{
>>> + struct msm_wb *wb = NULL;
>>> +
>>> + wb = devm_kzalloc(&pdev->dev, sizeof(*wb), GFP_KERNEL);
>>> + if (!wb)
>>> + return ERR_PTR(-ENOMEM);
>>> +
>>> + wb->pdev = pdev;
>>> + wb->priv_data = devm_kzalloc(&pdev->dev, sizeof(*wb->priv_data),
>>> + GFP_KERNEL);
>>> + if (!wb->priv_data)
>>> + return ERR_PTR(-ENOMEM);
>>> +
>>> + if (msm_wb_v4l2_init(wb)) {
>>> + pr_err("%s: wb v4l2 init failed\n", __func__);
>>> + return ERR_PTR(-ENODEV);
>>> + }
>>> +
>> Seems like we're leaking wb and/or wb->priv_data. Add a label and
>> consolidate error handling in there ?
>
> Since the devm_kzalloc function is used here, the system should take care
> freeing the memory.
You're spot on. Somehow I did not notice that we're using the devm_
version of kzalloc.
/me runs in shame :-)

Cheers,
Emil
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/