From 02d7324337c0223f3775d539380e32f603646a52 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 1 Nov 2017 17:05:44 -0400 Subject: 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 --- drivers/media/radio/radio-si476x.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'drivers/media/radio') diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c index 540ac887a63c..d1355ac2df2f 100644 --- a/drivers/media/radio/radio-si476x.c +++ b/drivers/media/radio/radio-si476x.c @@ -759,7 +759,7 @@ static int si476x_radio_s_hw_freq_seek(struct file *file, void *priv, { int err; enum si476x_func func; - u32 rangelow, rangehigh; + u32 rangelow = seek->rangelow, rangehigh = seek->rangehigh; struct si476x_radio *radio = video_drvdata(file); if (file->f_flags & O_NONBLOCK) @@ -771,23 +771,21 @@ static int si476x_radio_s_hw_freq_seek(struct file *file, void *priv, si476x_core_lock(radio->core); - if (!seek->rangelow) { + if (!rangelow) { err = regmap_read(radio->core->regmap, SI476X_PROP_SEEK_BAND_BOTTOM, &rangelow); - if (!err) - rangelow = si476x_to_v4l2(radio->core, rangelow); - else + if (err) goto unlock; + rangelow = si476x_to_v4l2(radio->core, rangelow); } - if (!seek->rangehigh) { + if (!rangehigh) { err = regmap_read(radio->core->regmap, SI476X_PROP_SEEK_BAND_TOP, &rangehigh); - if (!err) - rangehigh = si476x_to_v4l2(radio->core, rangehigh); - else + if (err) goto unlock; + rangehigh = si476x_to_v4l2(radio->core, rangehigh); } if (rangelow > rangehigh) { -- cgit From 4a3fad709bbc74c85fffff8903d17b5e35723365 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 4 Jan 2018 06:47:28 -0500 Subject: media: fix usage of whitespaces and on indentation On several places, whitespaces are being used for indentation, or even at the end of the line. Fix them. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/radio/radio-maxiradio.c | 2 +- drivers/media/radio/radio-mr800.c | 24 ++++++++++++------------ drivers/media/radio/si470x/radio-si470x-common.c | 24 ++++++++++++------------ drivers/media/radio/wl128x/fmdrv_common.h | 10 +++++----- 4 files changed, 30 insertions(+), 30 deletions(-) (limited to 'drivers/media/radio') diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c index 3aa5ad391581..95f06f3b35dc 100644 --- a/drivers/media/radio/radio-maxiradio.c +++ b/drivers/media/radio/radio-maxiradio.c @@ -13,7 +13,7 @@ * anybody does please mail me. * * For the pdf file see: - * http://www.nxp.com/acrobat_download2/expired_datasheets/TEA5757_5759_3.pdf + * http://www.nxp.com/acrobat_download2/expired_datasheets/TEA5757_5759_3.pdf * * * CHANGES: diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c index c9f59129af79..dc6c4f985911 100644 --- a/drivers/media/radio/radio-mr800.c +++ b/drivers/media/radio/radio-mr800.c @@ -31,22 +31,22 @@ * http://www.spinics.net/lists/linux-usb-devel/msg10109.html * * Version 0.01: First working version. - * It's required to blacklist AverMedia USB Radio - * in usbhid/hid-quirks.c + * It's required to blacklist AverMedia USB Radio + * in usbhid/hid-quirks.c * Version 0.10: A lot of cleanups and fixes: unpluging the device, - * few mutex locks were added, codinstyle issues, etc. - * Added stereo support. Thanks to - * Douglas Schilling Landgraf and - * David Ellingsworth - * for discussion, help and support. + * few mutex locks were added, codinstyle issues, etc. + * Added stereo support. Thanks to + * Douglas Schilling Landgraf and + * David Ellingsworth + * for discussion, help and support. * Version 0.11: Converted to v4l2_device. * * Many things to do: - * - Correct power management of device (suspend & resume) - * - Add code for scanning and smooth tuning - * - Add code for sensitivity value - * - Correct mistakes - * - In Japan another FREQ_MIN and FREQ_MAX + * - Correct power management of device (suspend & resume) + * - Add code for scanning and smooth tuning + * - Add code for sensitivity value + * - Correct mistakes + * - In Japan another FREQ_MIN and FREQ_MAX */ /* kernel includes */ diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c index c89a7d5b8c55..63869388152b 100644 --- a/drivers/media/radio/si470x/radio-si470x-common.c +++ b/drivers/media/radio/si470x/radio-si470x-common.c @@ -33,18 +33,18 @@ * - switched from bit structs to bit masks * - header file cleaned and integrated * 2008-01-14 Tobias Lorenz - * Version 1.0.2 - * - hex values are now lower case - * - commented USB ID for ADS/Tech moved on todo list - * - blacklisted si470x in hid-quirks.c - * - rds buffer handling functions integrated into *_work, *_read - * - rds_command in si470x_poll exchanged against simple retval - * - check for firmware version 15 - * - code order and prototypes still remain the same - * - spacing and bottom of band codes remain the same + * Version 1.0.2 + * - hex values are now lower case + * - commented USB ID for ADS/Tech moved on todo list + * - blacklisted si470x in hid-quirks.c + * - rds buffer handling functions integrated into *_work, *_read + * - rds_command in si470x_poll exchanged against simple retval + * - check for firmware version 15 + * - code order and prototypes still remain the same + * - spacing and bottom of band codes remain the same * 2008-01-16 Tobias Lorenz * Version 1.0.3 - * - code reordered to avoid function prototypes + * - code reordered to avoid function prototypes * - switch/case defaults are now more user-friendly * - unified comment style * - applied all checkpatch.pl v1.12 suggestions @@ -88,8 +88,8 @@ * - more safety checks, let si470x_get_freq return errno * - vidioc behavior corrected according to v4l2 spec * 2008-10-20 Alexey Klimov - * - add support for KWorld USB FM Radio FM700 - * - blacklisted KWorld radio in hid-core.c and hid-ids.h + * - add support for KWorld USB FM Radio FM700 + * - blacklisted KWorld radio in hid-core.c and hid-ids.h * 2008-12-03 Mark Lord * - add support for DealExtreme USB Radio * 2009-01-31 Bob Ross diff --git a/drivers/media/radio/wl128x/fmdrv_common.h b/drivers/media/radio/wl128x/fmdrv_common.h index 7f1514eb1c07..552e22ea6bf3 100644 --- a/drivers/media/radio/wl128x/fmdrv_common.h +++ b/drivers/media/radio/wl128x/fmdrv_common.h @@ -311,11 +311,11 @@ struct fm_event_msg_hdr { #define FM_RDS_GROUP_TYPE_MASK_15B ((unsigned long)1<<31) /* RX Alternate Frequency info */ -#define FM_RDS_MIN_AF 1 -#define FM_RDS_MAX_AF 204 -#define FM_RDS_MAX_AF_JAPAN 140 -#define FM_RDS_1_AF_FOLLOWS 225 -#define FM_RDS_25_AF_FOLLOWS 249 +#define FM_RDS_MIN_AF 1 +#define FM_RDS_MAX_AF 204 +#define FM_RDS_MAX_AF_JAPAN 140 +#define FM_RDS_1_AF_FOLLOWS 225 +#define FM_RDS_25_AF_FOLLOWS 249 /* RDS system type (RDS/RBDS) */ #define FM_RDS_SYSTEM_RDS 0 -- cgit From 6e6a8b5a38cb04d5ef35d4eb57836126b954e7c8 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 4 Jan 2018 13:08:56 -0500 Subject: media: replace all occurrences There are a lot of places where sequences of space/tabs are found. Get rid of all spaces before tabs. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/radio/radio-aimslab.c | 2 +- drivers/media/radio/radio-aztech.c | 2 +- drivers/media/radio/radio-cadet.c | 4 ++-- drivers/media/radio/radio-gemtek.c | 8 ++++---- drivers/media/radio/radio-rtrack2.c | 2 +- drivers/media/radio/radio-sf16fmi.c | 4 ++-- drivers/media/radio/radio-sf16fmr2.c | 2 +- drivers/media/radio/radio-tea5764.c | 2 +- drivers/media/radio/radio-terratec.c | 6 +++--- drivers/media/radio/tea575x.c | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) (limited to 'drivers/media/radio') diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index ea9308796741..5ef635e72e10 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c @@ -26,7 +26,7 @@ * Fully tested with the Keene USB FM Transmitter and the v4l2-compliance tool. */ -#include /* Modules */ +#include /* Modules */ #include /* Initdata */ #include /* request_region */ #include /* msleep */ diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c index f445327f282d..9e12c6027359 100644 --- a/drivers/media/radio/radio-aztech.c +++ b/drivers/media/radio/radio-aztech.c @@ -15,7 +15,7 @@ * Fully tested with the Keene USB FM Transmitter and the v4l2-compliance tool. */ -#include /* Modules */ +#include /* Modules */ #include /* Initdata */ #include /* request_region */ #include /* udelay */ diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c index 7575e5370a49..ec5c88801402 100644 --- a/drivers/media/radio/radio-cadet.c +++ b/drivers/media/radio/radio-cadet.c @@ -30,7 +30,7 @@ * Changed API to V4L2 */ -#include /* Modules */ +#include /* Modules */ #include /* Initdata */ #include /* request_region */ #include /* udelay */ @@ -503,7 +503,7 @@ static unsigned int cadet_poll(struct file *file, struct poll_table_struct *wait static const struct v4l2_file_operations cadet_fops = { .owner = THIS_MODULE, .open = cadet_open, - .release = cadet_release, + .release = cadet_release, .read = cadet_read, .unlocked_ioctl = video_ioctl2, .poll = cadet_poll, diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c index ddc12b16f77c..3ff4c4e1435f 100644 --- a/drivers/media/radio/radio-gemtek.c +++ b/drivers/media/radio/radio-gemtek.c @@ -22,7 +22,7 @@ * Fully tested with the Keene USB FM Transmitter and the v4l2-compliance tool. */ -#include /* Modules */ +#include /* Modules */ #include /* Initdata */ #include /* request_region */ #include /* udelay */ @@ -102,9 +102,9 @@ struct gemtek { u32 bu2614data; }; -#define BU2614_FREQ_BITS 16 /* D0..D15, Frequency data */ +#define BU2614_FREQ_BITS 16 /* D0..D15, Frequency data */ #define BU2614_PORT_BITS 3 /* P0..P2, Output port control data */ -#define BU2614_VOID_BITS 4 /* unused */ +#define BU2614_VOID_BITS 4 /* unused */ #define BU2614_FMES_BITS 1 /* CT, Frequency measurement beginning data */ #define BU2614_STDF_BITS 3 /* R0..R2, Standard frequency data */ #define BU2614_SWIN_BITS 1 /* S, Switch between FMIN / AMIN */ @@ -113,7 +113,7 @@ struct gemtek { #define BU2614_FMUN_BITS 1 /* GT, Frequency measurement time & unlock */ #define BU2614_TEST_BITS 1 /* TS, Test data is input */ -#define BU2614_FREQ_SHIFT 0 +#define BU2614_FREQ_SHIFT 0 #define BU2614_PORT_SHIFT (BU2614_FREQ_BITS + BU2614_FREQ_SHIFT) #define BU2614_VOID_SHIFT (BU2614_PORT_BITS + BU2614_PORT_SHIFT) #define BU2614_FMES_SHIFT (BU2614_VOID_BITS + BU2614_VOID_SHIFT) diff --git a/drivers/media/radio/radio-rtrack2.c b/drivers/media/radio/radio-rtrack2.c index 09cfbc373c92..abeaedd8d437 100644 --- a/drivers/media/radio/radio-rtrack2.c +++ b/drivers/media/radio/radio-rtrack2.c @@ -12,7 +12,7 @@ * Fully tested with actual hardware and the v4l2-compliance tool. */ -#include /* Modules */ +#include /* Modules */ #include /* Initdata */ #include /* request_region */ #include /* udelay */ diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c index 28a89466cddc..fc4e63d36e4c 100644 --- a/drivers/media/radio/radio-sf16fmi.c +++ b/drivers/media/radio/radio-sf16fmi.c @@ -17,7 +17,7 @@ */ #include /* __setup */ -#include /* Modules */ +#include /* Modules */ #include /* Initdata */ #include /* request_region */ #include /* udelay */ @@ -110,7 +110,7 @@ static inline int fmi_getsigstr(struct fmi *fmi) val = fmi->mute ? 0x00 : 0x08; /* mute/unmute */ outb(val, fmi->io); outb(val | 0x10, fmi->io); - msleep(143); /* was schedule_timeout(HZ/7) */ + msleep(143); /* was schedule_timeout(HZ/7) */ res = (int)inb(fmi->io + 1); outb(val, fmi->io); diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c index de79d5569c2a..7b07d42a9909 100644 --- a/drivers/media/radio/radio-sf16fmr2.c +++ b/drivers/media/radio/radio-sf16fmr2.c @@ -7,7 +7,7 @@ */ #include -#include /* Modules */ +#include /* Modules */ #include /* Initdata */ #include #include /* request_region */ diff --git a/drivers/media/radio/radio-tea5764.c b/drivers/media/radio/radio-tea5764.c index bc7e69e7e32e..afb763256fd6 100644 --- a/drivers/media/radio/radio-tea5764.c +++ b/drivers/media/radio/radio-tea5764.c @@ -417,7 +417,7 @@ static const struct v4l2_ioctl_ops tea5764_ioctl_ops = { static const struct video_device tea5764_radio_template = { .name = "TEA5764 FM-Radio", .fops = &tea5764_fops, - .ioctl_ops = &tea5764_ioctl_ops, + .ioctl_ops = &tea5764_ioctl_ops, .release = video_device_release_empty, }; diff --git a/drivers/media/radio/radio-terratec.c b/drivers/media/radio/radio-terratec.c index be10a802e3a9..4f116ea294fb 100644 --- a/drivers/media/radio/radio-terratec.c +++ b/drivers/media/radio/radio-terratec.c @@ -20,7 +20,7 @@ * Converted to V4L2 API by Mauro Carvalho Chehab */ -#include /* Modules */ +#include /* Modules */ #include /* Initdata */ #include /* request_region */ #include /* kernel radio structs */ @@ -45,12 +45,12 @@ static int radio_nr = -1; module_param(radio_nr, int, 0444); MODULE_PARM_DESC(radio_nr, "Radio device number"); -#define WRT_DIS 0x00 +#define WRT_DIS 0x00 #define CLK_OFF 0x00 #define IIC_DATA 0x01 #define IIC_CLK 0x02 #define DATA 0x04 -#define CLK_ON 0x08 +#define CLK_ON 0x08 #define WRT_EN 0x10 static struct radio_isa_card *terratec_alloc(void) diff --git a/drivers/media/radio/tea575x.c b/drivers/media/radio/tea575x.c index 4dc2067bce14..7412fe1b10c6 100644 --- a/drivers/media/radio/tea575x.c +++ b/drivers/media/radio/tea575x.c @@ -498,7 +498,7 @@ static const struct v4l2_ioctl_ops tea575x_ioctl_ops = { }; static const struct video_device tea575x_radio = { - .ioctl_ops = &tea575x_ioctl_ops, + .ioctl_ops = &tea575x_ioctl_ops, .release = video_device_release_empty, }; -- cgit