[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211115092840.GA26989@kadam>
Date: Mon, 15 Nov 2021 12:28:40 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
Cc: linuxarm@...wei.com, mauro.chehab@...wei.com,
Beatriz Martins de Carvalho
<martinsdecarvalhobeatriz@...il.com>,
Deepak R Varma <drv@...lo.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Tom Rix <trix@...hat.com>,
Tomi Valkeinen <tomi.valkeinen@...asonboard.com>,
linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
linux-staging@...ts.linux.dev, llvm@...ts.linux.dev
Subject: Re: [PATCH 2/3] media: atomisp-gc2235: drop an unused var
On Thu, Nov 11, 2021 at 11:08:52PM +0000, Mauro Carvalho Chehab wrote:
> Fix this clang Werror with W=1:
>
> drivers/staging/media/atomisp/i2c/atomisp-gc2235.c:573:6: error: variable 'ret' set but not used [-Werror,-Wunused-but-set-variable]
> int ret = -1;
> ^
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
> ---
>
Looks good.
There should be warning for "int x = -1;" followed by |= because that's
a no-op OR assignment.
I'm surprised that clang doesn't print errors about the other
implementations of power_ctrl().
drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
448 static int power_ctrl(struct v4l2_subdev *sd, bool flag)
449 {
450 int ret;
451 struct mt9m114_device *dev = to_mt9m114_sensor(sd);
452
453 if (!dev || !dev->platform_data)
454 return -ENODEV;
455
456 if (flag) {
457 ret = dev->platform_data->v2p8_ctrl(sd, 1);
458 if (ret == 0) {
459 ret = dev->platform_data->v1p8_ctrl(sd, 1);
460 if (ret)
461 ret = dev->platform_data->v2p8_ctrl(sd, 0);
462 }
463 } else {
464 ret = dev->platform_data->v2p8_ctrl(sd, 0);
465 ret = dev->platform_data->v1p8_ctrl(sd, 0);
^^^^^^
466 }
467 return ret;
468 }
469
470 static int gpio_ctrl(struct v4l2_subdev *sd, bool flag)
471 {
472 int ret;
473 struct mt9m114_device *dev = to_mt9m114_sensor(sd);
474
475 if (!dev || !dev->platform_data)
476 return -ENODEV;
477
478 /*
479 * Note: current modules wire only one GPIO signal (RESET#),
480 * but the schematic wires up two to the connector. BIOS
481 * versions have been unfortunately inconsistent with which
482 * ACPI index RESET# is on, so hit both
483 */
484
485 if (flag) {
486 ret = dev->platform_data->gpio0_ctrl(sd, 0);
487 ret = dev->platform_data->gpio1_ctrl(sd, 0);
^^^^^^^
488 msleep(60);
489 ret |= dev->platform_data->gpio0_ctrl(sd, 1);
490 ret |= dev->platform_data->gpio1_ctrl(sd, 1);
491 } else {
regards,
dan carpenter
Powered by blists - more mailing lists