[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220822075101.75dv3cv2evb2qeqq@pengutronix.de>
Date: Mon, 22 Aug 2022 09:51:01 +0200
From: Marco Felsch <m.felsch@...gutronix.de>
To: Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc: mchehab@...nel.org, laurent.pinchart+renesas@...asonboard.com,
jacopo+renesas@...ndi.org, akinobu.mita@...il.com,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel@...gutronix.de
Subject: Re: [PATCH 2/4] media: mt9m111: fix subdev API usage
Hi Sakari,
On 22-08-22, Sakari Ailus wrote:
> Hi Marco,
>
> On Thu, Aug 18, 2022 at 04:47:10PM +0200, Marco Felsch wrote:
> > In case of I2C transfer failures the driver return failure codes which
> > are not allowed according the API documentation. Fix that by ignore the
> > register access failure codes.
> >
> > Signed-off-by: Marco Felsch <m.felsch@...gutronix.de>
> > ---
> > drivers/media/i2c/mt9m111.c | 116 ++++++++++++++++++++----------------
> > 1 file changed, 66 insertions(+), 50 deletions(-)
> >
> > diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c
> > index cdaf283e1309..53c4dac4e4bd 100644
> > --- a/drivers/media/i2c/mt9m111.c
> > +++ b/drivers/media/i2c/mt9m111.c
> > @@ -455,7 +455,7 @@ static int mt9m111_set_selection(struct v4l2_subdev *sd,
> > struct mt9m111 *mt9m111 = to_mt9m111(client);
> > struct v4l2_rect rect = sel->r;
> > int width, height;
> > - int ret, align = 0;
> > + int align = 0;
> >
> > if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE ||
> > sel->target != V4L2_SEL_TGT_CROP)
> > @@ -481,14 +481,13 @@ static int mt9m111_set_selection(struct v4l2_subdev *sd,
> > width = min(mt9m111->width, rect.width);
> > height = min(mt9m111->height, rect.height);
> >
> > - ret = mt9m111_setup_geometry(mt9m111, &rect, width, height, mt9m111->fmt->code);
> > - if (!ret) {
> > - mt9m111->rect = rect;
> > - mt9m111->width = width;
> > - mt9m111->height = height;
> > - }
> >
> > - return ret;
> > + mt9m111_setup_geometry(mt9m111, &rect, width, height, mt9m111->fmt->code);
>
> If the function can fail, it'd be much better to move it to s_stream
> callback than ignore the error.
>
> Same for the rest of such changes.
I did that in the following patch, but I can merge them if you want.
Regards,
Marco
Powered by blists - more mailing lists