lkml.org 
[lkml]   [2018]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v5 15/17] media: platform: Switch to v4l2_async_notifier_add_subdev
From
Date
Hi Sakari,


On 07/02/2018 04:23 AM, Sakari Ailus wrote:
> On Fri, Jun 29, 2018 at 11:49:59AM -0700, Steve Longerbeam wrote:
>> diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
>> index a96f53c..8464ceb 100644
>> --- a/drivers/media/platform/davinci/vpif_capture.c
>> +++ b/drivers/media/platform/davinci/vpif_capture.c
>> @@ -1553,7 +1553,7 @@ vpif_capture_get_pdata(struct platform_device *pdev)
>> sizeof(*chan->inputs),
>> GFP_KERNEL);
>> if (!chan->inputs)
>> - return NULL;
>> + goto err_cleanup;
>>
>> chan->input_count++;
>> chan->inputs[i].input.type = V4L2_INPUT_TYPE_CAMERA;
>> @@ -1587,28 +1587,30 @@ vpif_capture_get_pdata(struct platform_device *pdev)
>> rem->name, rem);
>> sdinfo->name = rem->full_name;
>>
>> - pdata->asd[i] = devm_kzalloc(&pdev->dev,
>> - sizeof(struct v4l2_async_subdev),
>> - GFP_KERNEL);
>> - if (!pdata->asd[i]) {
>> + pdata->asd[i] = v4l2_async_notifier_add_fwnode_subdev(
>> + &vpif_obj.notifier, of_fwnode_handle(rem),
>> + sizeof(struct v4l2_async_subdev));
>> + if (IS_ERR(pdata->asd[i])) {
>> of_node_put(rem);
>> - pdata = NULL;
>> - goto done;
>> + goto err_cleanup;
>> }
>>
>> - pdata->asd[i]->match_type = V4L2_ASYNC_MATCH_FWNODE;
>> - pdata->asd[i]->match.fwnode = of_fwnode_handle(rem);
>> - of_node_put(rem);
>> + of_node_put(endpoint);
> You end up putting the same endpoint twice in the successful case.
>
> One way to address that would be to get the OF node's remote port parent
> (i.e. the device) immediately so you can forget OF node use counts in error
> handling.
>

Thanks for catching. I ended up doing what you suggested, moved the get
of remote port parent to just after getting local endpoint node, and removed
node puts in the done and cleanup paths, in vpif_capture_get_pdata().

Steve

\
 
 \ /
  Last update: 2018-07-07 23:10    [W:0.072 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site