All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: linuxarm@huawei.com, mauro.chehab@huawei.com,
	Beatriz Martins de Carvalho <martinsdecarvalhobeatriz@gmail.com>,
	Deepak R Varma <drv@mailo.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Tom Rix <trix@redhat.com>,
	Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	linux-staging@lists.linux.dev, llvm@lists.linux.dev
Subject: Re: [PATCH 2/3] media: atomisp-gc2235: drop an unused var
Date: Mon, 15 Nov 2021 12:28:40 +0300	[thread overview]
Message-ID: <20211115092840.GA26989@kadam> (raw)
In-Reply-To: <81245e1273f2e0e96a520b9d00cd415f65d37b48.1636672052.git.mchehab+huawei@kernel.org>

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@kernel.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


  parent reply	other threads:[~2021-11-15  9:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 23:08 [PATCH 0/3] Fix some W=1 clang Werror at staging/media Mauro Carvalho Chehab
2021-11-11 23:08 ` Mauro Carvalho Chehab
2021-11-11 23:08 ` [PATCH 1/3] media: ipu3: drop an unused variable Mauro Carvalho Chehab
2021-11-11 23:08   ` Mauro Carvalho Chehab
2021-11-12 20:43   ` Nathan Chancellor
2021-11-16 12:57   ` Sakari Ailus
2021-11-11 23:08 ` [PATCH 2/3] media: atomisp-gc2235: drop an unused var Mauro Carvalho Chehab
2021-11-11 23:08   ` Mauro Carvalho Chehab
2021-11-12 20:46   ` Nathan Chancellor
2021-11-15  9:28   ` Dan Carpenter [this message]
2021-11-15 17:55     ` Nick Desaulniers
2021-11-11 23:08 ` [PATCH 3/3] media: atomisp: handle errors at sh_css_create_isp_params() Mauro Carvalho Chehab
2021-11-11 23:08   ` Mauro Carvalho Chehab
2021-11-12 20:49   ` Nathan Chancellor
2021-11-15  9:50   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211115092840.GA26989@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=drv@mailo.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linuxarm@huawei.com \
    --cc=llvm@lists.linux.dev \
    --cc=martinsdecarvalhobeatriz@gmail.com \
    --cc=mauro.chehab@huawei.com \
    --cc=mchehab+huawei@kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.