media: atomisp: improve error handling in gc2235_detect()
authorTom Rix <trix@redhat.com>
Fri, 21 May 2021 19:48:05 +0000 (21:48 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 23 Jul 2021 07:04:02 +0000 (09:04 +0200)
commit280355522d61d106e52cf0536dcf2807a15aec37
treed02911d2a271d47304fd08252e518d583fee717f
parent6bdad3bb7eb1d91e10998eb21b6f9159064b53af
media: atomisp: improve error handling in gc2235_detect()

Static analysis reports this representative problem

atomisp-gc2235.c:867:20: warning: The right operand
  of '|' is a garbage value
        id = ((high << 8) | low);
                          ^ ~~~
When gc2235_read_reg() fails, its return val is never written.

For gc2235_detect(), high and low are or-ed and compared
with GC2235_ID, 0x2235.  Initialize both to 0 and skip
checking the read returns, it's errors are not passed up, only
-ENODEV is.

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