On Tue, Mar 01, 2022 at 06:11:50PM +0200, Tomi Valkeinen wrote: > From: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> > > If the subdev doesn't implement routing support, fallback to pad config > as the storage for pad formats. This allows using the V4L2 subdev active > state API and the v4l2_subdev_get_fmt() helper in subdev drivers that > don't implement routing support. > > Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> > --- > drivers/media/v4l2-core/v4l2-subdev.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c > index c1cc9b91dba7..7f50871054cd 100644 > --- a/drivers/media/v4l2-core/v4l2-subdev.c > +++ b/drivers/media/v4l2-core/v4l2-subdev.c > @@ -1512,8 +1512,14 @@ int v4l2_subdev_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_state *state, > { > struct v4l2_mbus_framefmt *fmt; > > - fmt = v4l2_subdev_state_get_stream_format(state, format->pad, > - format->stream); > + if (sd->flags & V4L2_SUBDEV_FL_MULTIPLEXED) > + fmt = v4l2_subdev_state_get_stream_format(state, format->pad, > + format->stream); > + else if (format->pad < sd->entity.num_pads && format->stream == 0) > + fmt = v4l2_subdev_get_try_format(sd, state, format->pad); > + else > + fmt = NULL; You could initialize fmt = NULL and skip the else Reviewed-by: Jacopo Mondi <jacopo@xxxxxxxxxx> Thanks j > + > if (!fmt) > return -EINVAL; > > -- > 2.25.1 >