]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
media: staging: atomisp: rework reading the id and revision values
authorTom Rix <trix@redhat.com>
Sat, 26 Mar 2022 19:18:53 +0000 (19:18 +0000)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 8 Jul 2022 15:43:43 +0000 (16:43 +0100)
commit5088bbde3ad8d3e2c8a6614d87bea0a3df176e69
tree31c99856457e563b7c54bee9453a55a1a772cb62
parent9799a3bf8a36be69b1a60f64d4134d08110150a9
media: staging: atomisp: rework reading the id and revision values

Clang static analysis reports this representative issue
atomisp-ov2722.c:920:3: warning: 3rd function call
  argument is an uninitialized value
  dev_err(&client->dev, "sensor_id_high = 0x%x\n", high);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

high and low are only set when ov2722_read_reg() is successful.
Reporting the high value when there is an error is not
meaningful.  The later read for low is not checked.  high
and low are or-ed together and checked against a non zero
value.

Remove the unneeded error reporting for high.  Initialize
high and low to 0 and use the id check to determine if
the reads were successful

The later read for revision is not checked.  If it
fails the old high value will be used and the revision
will be misreported.

Since the revision is only reported and not checked or
stored it is not necessary to return if the read with
successful.  This makes the ret variable unnecessary
so remove it.

Link: https://lore.kernel.org/linux-media/20220326191853.2914552-1-trix@redhat.com
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c