From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B734DC28D13 for ; Mon, 22 Aug 2022 07:51:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233435AbiHVHvN (ORCPT ); Mon, 22 Aug 2022 03:51:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233445AbiHVHvL (ORCPT ); Mon, 22 Aug 2022 03:51:11 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EFA12AE0D for ; Mon, 22 Aug 2022 00:51:10 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oQ2D8-0001Hr-1H; Mon, 22 Aug 2022 09:51:02 +0200 Received: from mfe by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1oQ2D7-000666-1O; Mon, 22 Aug 2022 09:51:01 +0200 Date: Mon, 22 Aug 2022 09:51:01 +0200 From: Marco Felsch To: Sakari Ailus Cc: mchehab@kernel.org, laurent.pinchart+renesas@ideasonboard.com, jacopo+renesas@jmondi.org, akinobu.mita@gmail.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: Re: [PATCH 2/4] media: mt9m111: fix subdev API usage Message-ID: <20220822075101.75dv3cv2evb2qeqq@pengutronix.de> References: <20220818144712.997477-1-m.felsch@pengutronix.de> <20220818144712.997477-2-m.felsch@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > --- > > 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