Skip to content

Commit ab92c09

Browse files
6by9pelwell
authored andcommitted
staging: bcm2835-codec: NULL component handle on queue_setup failure
queue_setup tries creating the relevant MMAL component and configures the input and output ports as we're expecting to start streaming. If the port configuration failed then it destroyed the component, but failed to clear the component handle, therefore release tried destroying the component again. Adds some logging should the port config fail as well. Signed-off-by: Dave Stevenson <[email protected]>
1 parent e086acf commit ab92c09

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,13 +1776,21 @@ static int bcm2835_codec_create_component(struct bcm2835_codec_ctx *ctx)
17761776

17771777
ret = vchiq_mmal_port_set_format(dev->instance,
17781778
&ctx->component->input[0]);
1779-
if (ret < 0)
1779+
if (ret < 0) {
1780+
v4l2_dbg(1, debug, &dev->v4l2_dev,
1781+
"%s: vchiq_mmal_port_set_format ip port failed\n",
1782+
__func__);
17801783
goto destroy_component;
1784+
}
17811785

17821786
ret = vchiq_mmal_port_set_format(dev->instance,
17831787
&ctx->component->output[0]);
1784-
if (ret < 0)
1788+
if (ret < 0) {
1789+
v4l2_dbg(1, debug, &dev->v4l2_dev,
1790+
"%s: vchiq_mmal_port_set_format op port failed\n",
1791+
__func__);
17851792
goto destroy_component;
1793+
}
17861794

17871795
if (dev->role == ENCODE) {
17881796
u32 param = 1;
@@ -1812,11 +1820,14 @@ static int bcm2835_codec_create_component(struct bcm2835_codec_ctx *ctx)
18121820
ctx->q_data[V4L2_M2M_DST].sizeimage,
18131821
ctx->component->output[0].minimum_buffer.size);
18141822
}
1823+
v4l2_dbg(2, debug, &dev->v4l2_dev, "%s: component created as %s\n",
1824+
__func__, components[dev->role]);
18151825

18161826
return 0;
18171827

18181828
destroy_component:
18191829
vchiq_mmal_component_finalise(ctx->dev->instance, ctx->component);
1830+
ctx->component = NULL;
18201831

18211832
return ret;
18221833
}

0 commit comments

Comments
 (0)