]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
media: qt1010: fix usage of unititialized value
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 1 Sep 2020 09:05:19 +0000 (11:05 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 3 Sep 2020 09:07:57 +0000 (11:07 +0200)
commit7a9b56123a036483d3b26bbd37d0dab4ca4c9eae
tree0a45566554b6bf9715b48325e0ec67a16384f103
parentddc11db26ccbd40ccb42449b747c86c12f2ec636
media: qt1010: fix usage of unititialized value

As pointed by smatch:

drivers/media/tuners/qt1010.c:239 qt1010_init_meas1() error: uninitialized symbol 'val2'.
drivers/media/tuners/qt1010.c:273 qt1010_init_meas2() error: uninitialized symbol 'val'.

The logic is ok, but it is hard for static analyzers
to parse it, as it depends on a value read in the middle
of a loop.

Also, it takes a while for humans to verify.

Re-write the first function to use a more direct way.

At the second one, I opted to just initialize the read var,
in order to shut up the report.

While here, address a few coding style issues at the
function code.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/tuners/qt1010.c