media: radio-si476x: fix behavior when seek->range* are defined
authorMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 1 Nov 2017 21:05:44 +0000 (17:05 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 11 Dec 2017 18:04:51 +0000 (13:04 -0500)
commit02d7324337c0223f3775d539380e32f603646a52
tree2579709a778712acb375ef4863dd19b6606a7bf7
parentbc3cad2b9261de7a5fa7632d30271e6d8418cb8f
media: radio-si476x: fix behavior when seek->range* are defined

The logic at si476x_radio_s_hw_freq_seek() checks if the
frequency range that will be used to handle hardware seek
has the minimal frequency under rangelow. That works fine
if userspace zeros both fields. However, if userspace
fills either seek->rangelow or seek-rangehigh, it won't
read the corresponding range from the device, causing the
values to be unitialized, as warned by smatch:

drivers/media/radio/radio-si476x.c:789 si476x_radio_s_hw_freq_seek() error: uninitialized symbol 'rangelow'.
drivers/media/radio/radio-si476x.c:789 si476x_radio_s_hw_freq_seek() error: uninitialized symbol 'rangehigh'.

Fix it by initializing those vars from the values present at
the struct v4l2_hw_freq_seek.

While here, simplify the logic which reads such values from
the hardware limits.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/radio/radio-si476x.c