summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2017-12-13media: dvb_frontend: Add commands implementation for compat ioctJaedon Shin1-0/+131
The dtv_properties structure and the dtv_property structure are different sizes in 32-bit and 64-bit system. This patch provides FE_SET_PROPERTY and FE_GET_PROPERTY ioctl commands implementation for 32-bit user space applications. Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: dvb_frontend: Add compat_ioctl callbackJaedon Shin2-17/+12
Adds compat_ioctl for 32-bit user space applications on a 64-bit system. [m.chehab@osg.samsung.com: add missing include compat.h] Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: dvb_frontend: Add unlocked_ioctl in dvb_frontend.cJaedon Shin1-3/+14
Adds unlocked ioctl function directly in dvb_frontend.c instead of using dvb_generic_ioctl(). Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: dvb_usb_pctv452e: module refcount changes were unbalancedWolfgang Rohdewald1-0/+8
dvb_frontend will call dvb_detach for: - stb0899_detach in dvb_frontend_release and - stb0899_release in __dvb_frontend_free But we only do dvb_attach(stb0899_attach). Increment the module refcount instead. Signed-off-by: Wolfgang Rohdewald <wolfgang@rohdewald.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: dvb_frontend: fix ifnullfree.cocci warningsFengguang Wu1-2/+1
drivers/media/dvb-core/dvb_frontend.c:154:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values. NULL check before some freeing functions is not needed. Based on checkpatch warning "kfree(NULL) is safe this check is probably not required" and kfreeaddr.cocci by Julia Lawall. Generated by: scripts/coccinelle/free/ifnullfree.cocci Fixes: b1cb7372fa82 ("dvb_frontend: don't use-after-free the frontend struct") Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: dvb-frontends/stv0910: remove unneeded dvb_math.h includeDaniel Scheller1-1/+0
Since nothing from dvb_math.h is used, remove the unneeded include. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: dvb-frontends/stv0910: remove unneeded symbol rate inquiryDaniel Scheller1-2/+0
tracking_optimization() doesn't make use of the symbol rate reported by the demodulator, so remove the unneeded inquiry and the now unneeded variable. Reported-by: Richard Scobie <rascobie@slingshot.co.nz> Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <rascobie@slingshot.co.nz> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: dvb-frontends/stv0910: read symbolrate in get_frontend()Daniel Scheller1-0/+5
Utilise get_cur_symbol_rate() in get_frontend() to update the dtv_frontend_properties with the current symbol rate as reported by the demodulator. Reported-by: Richard Scobie <rascobie@slingshot.co.nz> Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <rascobie@slingshot.co.nz> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: dvb-frontends/stv0910: remove unneeded check/call to get_if_freqDaniel Scheller1-3/+0
The result (if any) isn't used anywhere besides being assigned to a local variable (and the only current companion stv6111 doesn't even implement get_if_frequency()), thus remove the ptr check and the call, and also remove the now unused iffreq variable. Reported-by: Richard Scobie <rascobie@slingshot.co.nz> Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <rascobie@slingshot.co.nz> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: dvb-frontends/stv6111: handle gate_ctrl errorsDaniel Scheller1-17/+27
When a parent (demod) driver encounters and signals a problem with gate_ctrl(), don't blindly continue poking the I2C bus. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <rascobie@slingshot.co.nz> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: dvb-frontends/stv0910: WARN_ON() on consecutive mutex_unlock()Daniel Scheller1-2/+4
Stack dump when gate_ctrl() is called in a way that consecutive unlocks happen. This is a clear indication that other drivers interfacing with the stv0910 driver don't do things properly or don't check for failures, so dump stack so that those drivers can be identified and fixed. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <rascobie@slingshot.co.nz> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: frontends/stv0910: add field offsets to field definesDaniel Scheller1-927/+927
Each field (FSTV0910_XX) is declared as reg/off/unused/sign/mask. Add the missing offset value to the defines. Picked up from dddvb master, commit 8a1f27c3d22c ("add field offset to field defines") by Ralph Metzler <rjkm@metzlerbros.de>, adapted to match the comment style in the mainline driver. Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: dvb_frontend: remove redundant status self assignmentColin Ian King2-4/+0
The assignment status to itself is redundant and can be removed. Detected with Coccinelle. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: dib0700: add support for Xbox One Digital TV TunerOlli Salonen5-2/+139
Xbox One Digital TV Tuner is a low-cost USB 2.0 multistandard TV tuner. It supports DVB-T, DVB-T2 and DVB-C broadcast standards. USB bridge: DibCom 0700C Demodulator: Panasonic MN88472 Tuner: TDA18250BHN The demodulator requires firmware. Download one from here: http://palosaari.fi/linux/v4l-dvb/firmware/MN88472/02/latest/ Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: tda18250: support for new silicon tunerOlli Salonen6-0/+1115
NXP TDA18250 silicon tuner driver. Version 4 includes some checkpatch fixes. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: dvb-frontends/stv0367: remove redundant self assignment of temporaryColin Ian King1-2/+0
The self assignment of temporary is redundant and can be removed. Detected using coccinelle. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: stb0899: remove redundant self assignment of k_indirectColin Ian King1-2/+1
The self assignment of k_indirect is redundant and can be removed. Detected using coccinelle. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: c8sectpfe: Use resource_size function on memory resourceVasyl Gomonovych1-1/+1
To adapt fei->sram_size calculation via resource_size for memory size calculation before, in fei->sram = devm_ioremap_resource(dev, res). And make memory initialization range in memset_io for fei->sram appropriate Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com> Acked-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: c8sectpfe: fix potential NULL pointer dereference in ↵Gustavo A. R. Silva1-1/+3
c8sectpfe_timer_interrupt _channel_ is being dereferenced before it is null checked, hence there is a potential null pointer dereference. Fix this by moving the pointer dereference after _channel_ has been null checked. This issue was detected with the help of Coccinelle. Fixes: c5f5d0f99794 ("[media] c8sectpfe: STiH407/10 Linux DVB demux support") Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Acked-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-13media: c8sectpfe: DVB_C8SECTPFE should depend on HAS_DMAGeert Uytterhoeven1-1/+1
If NO_DMA=y: ERROR: "bad_dma_ops" [drivers/media/platform/sti/c8sectpfe/c8sectpfe.ko] undefined! Add a dependency on HAS_DMA to fix this. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-12media: dibx000_common: Fix line continuation formatJoe Perches1-4/+4
Line continuations with excess spacing causes unexpected output. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-12media: dvb_frontend: fix return error codeMauro Carvalho Chehab1-1/+1
The correct error code when a function is not defined is -ENOTSUPP. It was typoed wrong as -EOPNOTSUPP, with, unfortunately, exists, but it is not used by the DVB core. Thanks-to: Geert Uytterhoeven <geert@linux-m68k.org> Thanks-to: Arnd Bergmann <arnd@arndb.de> To make me revisit this code. Fixes: a9cb97c3e628 ("media: dvb_frontend: be sure to init dvb_frontend_handle_ioctl() return code") Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-12media: MAINTAINERS: add si2165 driverMatthias Schwarzott1-0/+8
Silicon Labs Si2165 DVB-C/T demod driver Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-12media: cx23885: Use semicolon after assignment instead of commaMatthias Schwarzott1-2/+2
End assignments by semicolon instead of comma. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-12media: cx231xx: Use semicolon after assignment instead of commaMatthias Schwarzott1-4/+4
End assignments by semicolon instead of comma. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-12media: si2165: Add DVBv3 wrapper for ber statisticsMatthias Schwarzott1-0/+26
Add read_ber function that reads from property cache to support DVBv3. The implementation is inspired by the cx24120 driver. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-12media: si2165: add DVBv3 wrapper for C/N statisticsMatthias Schwarzott1-0/+12
Add read_snr function that reads from property cache to support DVBv3. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-12media: si2165: add DVBv5 BER statisticsMatthias Schwarzott2-2/+66
Add support for BER statistics. Configure a measurement period of 30000 packets. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-12media: si2165: add DVBv5 C/N statistics for DVB-CMatthias Schwarzott2-2/+42
Add C/N statistics in dB to read_status (DVBv5). Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-12media: si2165: improve read_statusMatthias Schwarzott2-6/+37
Use check_signal register for DVB-T additionally. For DVB-C use ps_lock additionally. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-12media: si2165: Use constellation from property cache instead of hardcoded QAM256Matthias Schwarzott1-3/+26
Use constellation from property cache instead of always setting it to QAM256. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-12media: si2165: Write const value for lock timeoutMatthias Schwarzott1-2/+1
The lock timeout should not depend on the bandwidth. It should be either constant or depend on xtal frequency. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-12media: si2165: move ts parallel mode setting to the ts init codeMatthias Schwarzott1-2/+3
The TS parallel mode setting should be where all other TS settings are written. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-12media: si2165: define register macrosMatthias Schwarzott2-102/+169
Convert register numbers to macros. Correctness verified by comparing the disassembly before and after. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-12media: si2165: Make checkpatch happyMatthias Schwarzott5-79/+86
Fix almost all of checkpatch --strict warnings. The remaining warnings are about: * macro REG16 (should be enclosed in parentheses) * macro REG16 (Macro argument reuse) Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-12media: si2165: Convert debug printk to dev_dbgMatthias Schwarzott1-64/+15
Removed module parameter debug and the conditions based on it. Now it can be configured via dynamic debug. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-12media: si2165: Remove redundant KBUILD_MODNAME from dev_* loggingMatthias Schwarzott1-38/+31
Remove redundant repeated module name from messages. Before: si2165 8-0064: si2165: fw load finished After: si2165 8-0064: fw load finished Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-11media: pvrusb2: properly check endpoint typesAndrey Konovalov1-0/+12
As syzkaller detected, pvrusb2 driver submits bulk urb withount checking the the endpoint type is actually blunk. Add a check. usb 1-1: BOGUS urb xfer, pipe 3 != type 1 ------------[ cut here ]------------ WARNING: CPU: 1 PID: 2713 at drivers/usb/core/urb.c:449 usb_submit_urb+0xf8a/0x11d0 Modules linked in: CPU: 1 PID: 2713 Comm: pvrusb2-context Not tainted 4.14.0-rc1-42251-gebb2c2437d80 #210 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 task: ffff88006b7a18c0 task.stack: ffff880069978000 RIP: 0010:usb_submit_urb+0xf8a/0x11d0 drivers/usb/core/urb.c:448 RSP: 0018:ffff88006997f990 EFLAGS: 00010286 RAX: 0000000000000029 RBX: ffff880063661900 RCX: 0000000000000000 RDX: 0000000000000029 RSI: ffffffff86876d60 RDI: ffffed000d32ff24 RBP: ffff88006997fa90 R08: 1ffff1000d32fdca R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 1ffff1000d32ff39 R13: 0000000000000001 R14: 0000000000000003 R15: ffff880068bbed68 FS: 0000000000000000(0000) GS:ffff88006c600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000001032000 CR3: 000000006a0ff000 CR4: 00000000000006f0 Call Trace: pvr2_send_request_ex+0xa57/0x1d80 drivers/media/usb/pvrusb2/pvrusb2-hdw.c:3645 pvr2_hdw_check_firmware drivers/media/usb/pvrusb2/pvrusb2-hdw.c:1812 pvr2_hdw_setup_low drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2107 pvr2_hdw_setup drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2250 pvr2_hdw_initialize+0x548/0x3c10 drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2327 pvr2_context_check drivers/media/usb/pvrusb2/pvrusb2-context.c:118 pvr2_context_thread_func+0x361/0x8c0 drivers/media/usb/pvrusb2/pvrusb2-context.c:167 kthread+0x3a1/0x470 kernel/kthread.c:231 ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431 Code: 48 8b 85 30 ff ff ff 48 8d b8 98 00 00 00 e8 ee 82 89 fe 45 89 e8 44 89 f1 4c 89 fa 48 89 c6 48 c7 c7 40 c0 ea 86 e8 30 1b dc fc <0f> ff e9 9b f7 ff ff e8 aa 95 25 fd e9 80 f7 ff ff e8 50 74 f3 ---[ end trace 6919030503719da6 ]--- Signed-off-by: Andrey Konovalov <andreyknvl@google.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-11media: led-class-flash: better handle NULL flash structMauro Carvalho Chehab1-0/+4
The logic at V4L2 led core assumes that the flash struct can be null. However, it doesn't check for null while trying to set, causing some smatch to warn: drivers/media/v4l2-core/v4l2-flash-led-class.c:210 v4l2_flash_s_ctrl() error: we previously assumed 'fled_cdev' could be null (see line 200) Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-11media: dvb_frontend: be sure to init dvb_frontend_handle_ioctl() return codeMauro Carvalho Chehab1-1/+3
As smatch warned: drivers/media/dvb-core/dvb_frontend.c:2468 dvb_frontend_handle_ioctl() error: uninitialized symbol 'err'. The ioctl handler actually got a regression here: before changeset d73dcf0cdb95 ("media: dvb_frontend: cleanup ioctl handling logic"), the code used to return -EOPNOTSUPP if an ioctl handler was not implemented on a driver. After the change, it may return a random value. Fixes: d73dcf0cdb95 ("media: dvb_frontend: cleanup ioctl handling logic") Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Tested-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-11media: xc5000: better handle I2C error messagesMauro Carvalho Chehab1-8/+14
As warned by smatch, there are several places where the I2C transfer may fail, leading into inconsistent behavior: drivers/media/tuners/xc5000.c:689 xc_debug_dump() error: uninitialized symbol 'regval'. drivers/media/tuners/xc5000.c:841 xc5000_is_firmware_loaded() error: uninitialized symbol 'id'. drivers/media/tuners/xc5000.c:939 xc5000_set_tv_freq() error: uninitialized symbol 'pll_lock_status'. drivers/media/tuners/xc5000.c:1195 xc_load_fw_and_init_tuner() error: uninitialized symbol 'pll_lock_status'. Handle the return codes from the I2C transfer, in order to address those issues. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-11media: mxl111sf: improve error handling logicMauro Carvalho Chehab1-2/+7
As reported by smatch: drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c:485 mxl111sf_demod_read_signal_strength() error: uninitialized symbol 'modulation'. The mxl111sf_demod_read_signal_strength() just ignores if something gets wrong while reading snr or modulation. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-11media: drxd_hard: better handle I2C errorsMauro Carvalho Chehab1-12/+10
As warned by smatch: drivers/media/dvb-frontends/drxd_hard.c:989 HI_Command() error: uninitialized symbol 'waitCmd'. drivers/media/dvb-frontends/drxd_hard.c:1306 SC_WaitForReady() error: uninitialized symbol 'curCmd'. drivers/media/dvb-frontends/drxd_hard.c:1322 SC_SendCommand() error: uninitialized symbol 'errCode'. drivers/media/dvb-frontends/drxd_hard.c:1339 SC_ProcStartCommand() error: uninitialized symbol 'scExec'. The error handling on several places are somewhat flawed, as they don't check if Read16() returns an error. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-11media: cxd2841er: ensure that status will always be availableMauro Carvalho Chehab1-2/+6
The loop with read status use a dynamic timeout value, calculated from symbol rate. It should run the loop at least one time for the status to be handled after the loop. While this should, in practice, happen every time, it doesn't hurt to change the logic to make it explicit. This solves a smatch warning: drivers/media/dvb-frontends/cxd2841er.c:3350 cxd2841er_set_frontend_s() error: uninitialized symbol 'status'. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-11media: cx25821-alsa: fix usage of a pointer printkMauro Carvalho Chehab1-2/+2
As warned by smatch: drivers/media/pci/cx25821/cx25821-alsa.c:155 cx25821_alsa_dma_init() warn: argument 3 to %08lx specifier is cast from pointer Use the standard %p to print a pointer. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-11media: dvbsky: shut up a bogus warningMauro Carvalho Chehab1-2/+2
Smatch gives two bogus warnings on this driver: drivers/media/usb/dvb-usb-v2/dvbsky.c:336 dvbsky_s960_attach() error: uninitialized symbol 'i2c_adapter'. drivers/media/usb/dvb-usb-v2/dvbsky.c:459 dvbsky_s960c_attach() error: uninitialized symbol 'i2c_adapter'. Shut them up. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-11media: m88rs2000: handle the case where tuner doesn't have get_frequencyMauro Carvalho Chehab1-4/+7
If the tuner doesn't have get_frequency() callback, the current code will place a random value as the frequency offset. That doesn't seem right! The better is to just assume that, on such case, the tuner was able to set the exact frequency that was requested. Fixes a smatch warning: drivers/media/dvb-frontends/m88rs2000.c:639 m88rs2000_set_frontend() error: uninitialized symbol 'tuner_freq'. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-11media: pt1: fix logic when pt1_nr_tables is zero or negativeMauro Carvalho Chehab1-8/+9
pt1_nr_tables is a modprobe parameter. The way the logic handles it, it can't be negative. However, user can set it to zero. If set to zero, however, it will cause troubles at pt1_init_tables(), as reported by smatch: drivers/media/pci/pt1/pt1.c:468 pt1_init_tables() error: uninitialized symbol 'first_pfn'. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-11media: ov9650: fix bogus warningsMauro Carvalho Chehab1-4/+6
The smatch logic gets confused with the syntax used to check if the ov9650x_read() reads succedded: drivers/media/i2c/ov9650.c:895 __g_volatile_ctrl() error: uninitialized symbol 'reg2'. drivers/media/i2c/ov9650.c:895 __g_volatile_ctrl() error: uninitialized symbol 'reg1'. There's nothing wrong with the original logic, except that it is a little more harder to review. So, let's stick with the syntax that won't cause read issues. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Reviewed-by: Nicholas Mc Guire <hofrat@osadl.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-11media: mb86a16: avoid division by zeroMauro Carvalho Chehab1-6/+6
As warned by smatch: drivers/media/dvb-frontends/mb86a16.c:1690 mb86a16_read_ber() error: uninitialized symbol 'timer'. drivers/media/dvb-frontends/mb86a16.c:1706 mb86a16_read_ber() error: uninitialized symbol 'timer'. There is a potential risk of doing a division by zero if timer is not handled well. Enforce it by setting a bit mask for the values used to select the timer. It should be noticed that I don't have mb86a16 datasheet. So, the bitmask was guessed based on the existing checks for the field. At worse case scenario, it will just show a badly calculated bit error rate, but it won't crash. While here, optimize the logic to prevent uneeded tests. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>