[git:media_tree/master] media: selftests: ir: fix ir_loopback test failure
This is an automatic generated email to let you know that the following patch were queued: Subject: media: selftests: ir: fix ir_loopback test failure Author: Sean Young Date:Fri Aug 9 19:02:59 2019 -0300 The decoder is called rc-mm, not rcmm. This was renamed late in the cycle so this bug crept in. Acked-by: Shuah Khan Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab tools/testing/selftests/ir/ir_loopback.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- diff --git a/tools/testing/selftests/ir/ir_loopback.c b/tools/testing/selftests/ir/ir_loopback.c index e700e09e3682..af7f9c7d59bc 100644 --- a/tools/testing/selftests/ir/ir_loopback.c +++ b/tools/testing/selftests/ir/ir_loopback.c @@ -54,9 +54,9 @@ static const struct { { RC_PROTO_RC6_MCE, "rc-6-mce", 0x7fff, "rc-6" }, { RC_PROTO_SHARP, "sharp", 0x1fff, "sharp" }, { RC_PROTO_IMON, "imon", 0x7fff, "imon" }, - { RC_PROTO_RCMM12, "rcmm-12", 0x0fff, "rcmm" }, - { RC_PROTO_RCMM24, "rcmm-24", 0x00ff, "rcmm" }, - { RC_PROTO_RCMM32, "rcmm-32", 0x, "rcmm" }, + { RC_PROTO_RCMM12, "rcmm-12", 0x0fff, "rc-mm" }, + { RC_PROTO_RCMM24, "rcmm-24", 0x00ff, "rc-mm" }, + { RC_PROTO_RCMM32, "rcmm-32", 0x, "rc-mm" }, }; int lirc_open(const char *rc) ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_tree/master] media: dvb_frontend.h: Fix shifting signed 32-bit value problem
This is an automatic generated email to let you know that the following patch were queued: Subject: media: dvb_frontend.h: Fix shifting signed 32-bit value problem Author: Luke Nowakowski-Krijger Date:Thu Jul 4 17:58:12 2019 -0300 Fix DVBFE_ALGO_RECOVERY and DVBFE_ALGO_SEARCH_ERROR use BIT macro which fixes undefined behavior error by certain compilers. Also changed all other bit shifted definitions to use macro for better readability. Signed-off-by: Luke Nowakowski-Krijger Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab include/media/dvb_frontend.h | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-) --- diff --git a/include/media/dvb_frontend.h b/include/media/dvb_frontend.h index f05cd7b94a2c..0d76fa4551b3 100644 --- a/include/media/dvb_frontend.h +++ b/include/media/dvb_frontend.h @@ -41,6 +41,7 @@ #include #include #include +#include #include @@ -141,10 +142,10 @@ struct analog_parameters { * These devices have AUTO recovery capabilities from LOCK failure */ enum dvbfe_algo { - DVBFE_ALGO_HW = (1 << 0), - DVBFE_ALGO_SW = (1 << 1), - DVBFE_ALGO_CUSTOM = (1 << 2), - DVBFE_ALGO_RECOVERY = (1 << 31) + DVBFE_ALGO_HW = BIT(0), + DVBFE_ALGO_SW = BIT(1), + DVBFE_ALGO_CUSTOM = BIT(2), + DVBFE_ALGO_RECOVERY = BIT(31), }; /** @@ -170,12 +171,12 @@ enum dvbfe_algo { * The frontend search algorithm was requested to search again */ enum dvbfe_search { - DVBFE_ALGO_SEARCH_SUCCESS = (1 << 0), - DVBFE_ALGO_SEARCH_ASLEEP= (1 << 1), - DVBFE_ALGO_SEARCH_FAILED= (1 << 2), - DVBFE_ALGO_SEARCH_INVALID = (1 << 3), - DVBFE_ALGO_SEARCH_AGAIN = (1 << 4), - DVBFE_ALGO_SEARCH_ERROR = (1 << 31), + DVBFE_ALGO_SEARCH_SUCCESS = BIT(0), + DVBFE_ALGO_SEARCH_ASLEEP= BIT(1), + DVBFE_ALGO_SEARCH_FAILED= BIT(2), + DVBFE_ALGO_SEARCH_INVALID = BIT(3), + DVBFE_ALGO_SEARCH_AGAIN = BIT(4), + DVBFE_ALGO_SEARCH_ERROR = BIT(31), }; /** ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_tree/master] media: ir-kbd-i2c: convert to i2c_new_dummy_device()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ir-kbd-i2c: convert to i2c_new_dummy_device() Author: Wolfram Sang Date:Thu Aug 8 12:53:28 2019 -0300 Convert this driver to use the new i2c_new_dummy_device() call and bail out if the dummy device cannot be registered to make failure more visible to the user. Signed-off-by: Wolfram Sang Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ir-kbd-i2c.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) --- diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c index 96932779ca37..e8119ad0bc71 100644 --- a/drivers/media/i2c/ir-kbd-i2c.c +++ b/drivers/media/i2c/ir-kbd-i2c.c @@ -885,9 +885,11 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) INIT_DELAYED_WORK(>work, ir_work); if (probe_tx) { - ir->tx_c = i2c_new_dummy(client->adapter, 0x70); - if (!ir->tx_c) { + ir->tx_c = i2c_new_dummy_device(client->adapter, 0x70); + if (IS_ERR(ir->tx_c)) { dev_err(>dev, "failed to setup tx i2c address"); + err = PTR_ERR(ir->tx_c); + goto err_out_free; } else if (!zilog_init(ir)) { ir->carrier = 38000; ir->duty_cycle = 40; @@ -904,7 +906,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) return 0; err_out_free: - if (ir->tx_c) + if (!IS_ERR(ir->tx_c)) i2c_unregister_device(ir->tx_c); /* Only frees rc if it were allocated internally */ @@ -918,8 +920,7 @@ static int ir_remove(struct i2c_client *client) cancel_delayed_work_sync(>work); - if (ir->tx_c) - i2c_unregister_device(ir->tx_c); + i2c_unregister_device(ir->tx_c); rc_unregister_device(ir->rc); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_tree/master] media: tm6000: double free if usb disconnect while streaming
This is an automatic generated email to let you know that the following patch were queued: Subject: media: tm6000: double free if usb disconnect while streaming Author: Sean Young Date:Tue Aug 13 13:45:09 2019 -0300 The usb_bulk_urb will kfree'd on disconnect, so ensure the pointer is set to NULL after each free. stop stream urb killing urb buffer free tm6000: got start feed request tm6000_start_feed tm6000: got start stream request tm6000_start_stream tm6000: pipe reset tm6000: got start feed request tm6000_start_feed tm6000: got start feed request tm6000_start_feed tm6000: got start feed request tm6000_start_feed tm6000: got start feed request tm6000_start_feed tm6000: IR URB failure: status: -71, length 0 xhci_hcd :00:14.0: ERROR unknown event type 37 xhci_hcd :00:14.0: ERROR unknown event type 37 tm6000: error tm6000_urb_received usb 1-2: USB disconnect, device number 5 tm6000: disconnecting tm6000 #0 == BUG: KASAN: use-after-free in dvb_fini+0x75/0x140 [tm6000_dvb] Read of size 8 at addr 888241044060 by task kworker/2:0/22 CPU: 2 PID: 22 Comm: kworker/2:0 Tainted: GW 5.3.0-rc4+ #1 Hardware name: LENOVO 20KHCTO1WW/20KHCTO1WW, BIOS N23ET65W (1.40 ) 07/02/2019 Workqueue: usb_hub_wq hub_event Call Trace: dump_stack+0x9a/0xf0 print_address_description.cold+0xae/0x34f __kasan_report.cold+0x75/0x93 ? tm6000_fillbuf+0x390/0x3c0 [tm6000_alsa] ? dvb_fini+0x75/0x140 [tm6000_dvb] kasan_report+0xe/0x12 dvb_fini+0x75/0x140 [tm6000_dvb] tm6000_close_extension+0x51/0x80 [tm6000] tm6000_usb_disconnect.cold+0xd4/0x105 [tm6000] usb_unbind_interface+0xe4/0x390 device_release_driver_internal+0x121/0x250 bus_remove_device+0x197/0x260 device_del+0x268/0x550 ? __device_links_no_driver+0xd0/0xd0 ? usb_remove_ep_devs+0x30/0x3b usb_disable_device+0x122/0x400 usb_disconnect+0x153/0x430 hub_event+0x800/0x1e40 ? trace_hardirqs_on_thunk+0x1a/0x20 ? hub_port_debounce+0x1f0/0x1f0 ? retint_kernel+0x10/0x10 ? lock_is_held_type+0xf1/0x130 ? hub_port_debounce+0x1f0/0x1f0 ? process_one_work+0x4ae/0xa00 process_one_work+0x4ba/0xa00 ? pwq_dec_nr_in_flight+0x160/0x160 ? do_raw_spin_lock+0x10a/0x1d0 worker_thread+0x7a/0x5c0 ? process_one_work+0xa00/0xa00 kthread+0x1d5/0x200 ? kthread_create_worker_on_cpu+0xd0/0xd0 ret_from_fork+0x3a/0x50 Allocated by task 2682: save_stack+0x1b/0x80 __kasan_kmalloc.constprop.0+0xc2/0xd0 usb_alloc_urb+0x28/0x60 tm6000_start_feed+0x10a/0x300 [tm6000_dvb] dmx_ts_feed_start_filtering+0x86/0x120 [dvb_core] dvb_dmxdev_start_feed+0x121/0x180 [dvb_core] dvb_dmxdev_filter_start+0xcb/0x540 [dvb_core] dvb_demux_do_ioctl+0x7ed/0x890 [dvb_core] dvb_usercopy+0x97/0x1f0 [dvb_core] dvb_demux_ioctl+0x11/0x20 [dvb_core] do_vfs_ioctl+0x5d8/0x9d0 ksys_ioctl+0x5e/0x90 __x64_sys_ioctl+0x3d/0x50 do_syscall_64+0x74/0xe0 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 22: save_stack+0x1b/0x80 __kasan_slab_free+0x12c/0x170 kfree+0xfd/0x3a0 xhci_giveback_urb_in_irq+0xfe/0x230 xhci_td_cleanup+0x276/0x340 xhci_irq+0x1129/0x3720 __handle_irq_event_percpu+0x6e/0x420 handle_irq_event_percpu+0x6f/0x100 handle_irq_event+0x55/0x84 handle_edge_irq+0x108/0x3b0 handle_irq+0x2e/0x40 do_IRQ+0x83/0x1a0 Cc: sta...@vger.kernel.org Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/tm6000/tm6000-dvb.c | 3 +++ 1 file changed, 3 insertions(+) --- diff --git a/drivers/media/usb/tm6000/tm6000-dvb.c b/drivers/media/usb/tm6000/tm6000-dvb.c index e4d2dcd5cc0f..19c90fa9e443 100644 --- a/drivers/media/usb/tm6000/tm6000-dvb.c +++ b/drivers/media/usb/tm6000/tm6000-dvb.c @@ -97,6 +97,7 @@ static void tm6000_urb_received(struct urb *urb) printk(KERN_ERR "tm6000: error %s\n", __func__); kfree(urb->transfer_buffer); usb_free_urb(urb); + dev->dvb->bulk_urb = NULL; } } } @@ -127,6 +128,7 @@ static int tm6000_start_stream(struct tm6000_core *dev) dvb->bulk_urb->transfer_buffer = kzalloc(size, GFP_KERNEL); if (!dvb->bulk_urb->transfer_buffer) { usb_free_urb(dvb->bulk_urb); + dvb->bulk_urb = NULL; return -ENOMEM; } @@ -153,6 +155,7 @@ static int tm6000_start_stream(struct tm6000_core *dev) kfree(dvb->bulk_urb->transfer_buffer); usb_free_urb(dvb->bulk_urb); + dvb->bulk_urb = NULL; return ret; } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_tree/master] media: imon_raw: prevent "nonsensical timing event of duration 0"
This is an automatic generated email to let you know that the following patch were queued: Subject: media: imon_raw: prevent "nonsensical timing event of duration 0" Author: Sean Young Date:Fri Aug 9 19:31:08 2019 -0300 Sometimes the device sends IR data which is all space, no pulses whatsoever. Add the end of this the driver will put the rc device into idle mode when it already is in idle mode. The following will be logged: rc rc0: nonsensical timing event of duration 0 rc rc0: two consecutive events of type space Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab drivers/media/rc/imon_raw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/rc/imon_raw.c b/drivers/media/rc/imon_raw.c index e6723993b466..d4aedcf76418 100644 --- a/drivers/media/rc/imon_raw.c +++ b/drivers/media/rc/imon_raw.c @@ -85,7 +85,7 @@ static void imon_ir_data(struct imon *imon) offset = bit; } while (offset > 0); - if (packet_no == 0x0a) { + if (packet_no == 0x0a && !imon->rcdev->idle) { ir_raw_event_set_idle(imon->rcdev, true); ir_raw_event_handle(imon->rcdev); } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_tree/master] media: media/dvb: Use kmemdup rather than duplicating its implementation
This is an automatic generated email to let you know that the following patch were queued: Subject: media: media/dvb: Use kmemdup rather than duplicating its implementation Author: Fuqian Huang Date:Wed Jul 3 13:28:37 2019 -0300 kmemdup is introduced to duplicate a region of memory in a neat way. Rather than kmalloc/kzalloc + memcpy, which the programmer needs to write the size twice (sometimes lead to mistakes), kmemdup improves readability, leads to smaller code and also reduce the chances of mistakes. Suggestion to use kmemdup rather than using kmalloc/kzalloc + memcpy. Signed-off-by: Fuqian Huang Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab drivers/media/dvb-core/dvbdev.c | 3 +-- drivers/media/dvb-frontends/drx39xyj/drxj.c | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) --- diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c index a3393cd4e584..d7532f5a352a 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -476,7 +476,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, return -ENOMEM; } - dvbdevfops = kzalloc(sizeof(struct file_operations), GFP_KERNEL); + dvbdevfops = kmemdup(template->fops, sizeof(*dvbdevfops), GFP_KERNEL); if (!dvbdevfops){ kfree (dvbdev); @@ -492,7 +492,6 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, dvbdev->fops = dvbdevfops; init_waitqueue_head (>wait_queue); - memcpy(dvbdevfops, template->fops, sizeof(struct file_operations)); dvbdevfops->owner = adap->module; list_add_tail (>list_head, >device_list); diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c index a6876fa48753..2f5af4813a74 100644 --- a/drivers/media/dvb-frontends/drx39xyj/drxj.c +++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c @@ -12287,7 +12287,8 @@ struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c) if (state == NULL) goto error; - demod = kmalloc(sizeof(struct drx_demod_instance), GFP_KERNEL); + demod = kmemdup(_default_demod_g, + sizeof(struct drx_demod_instance), GFP_KERNEL); if (demod == NULL) goto error; @@ -12311,8 +12312,6 @@ struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c) state->demod = demod; /* setup the demod data */ - memcpy(demod, _default_demod_g, sizeof(struct drx_demod_instance)); - demod->my_i2c_dev_addr = demod_addr; demod->my_common_attr = demod_comm_attr; demod->my_i2c_dev_addr->user_data = state; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_tree/master] media: media/usb: Use kmemdup rather than duplicating its implementation
This is an automatic generated email to let you know that the following patch were queued: Subject: media: media/usb: Use kmemdup rather than duplicating its implementation Author: Fuqian Huang Date:Wed Jul 3 13:28:57 2019 -0300 kmemdup is introduced to duplicate a region of memory in a neat way. Rather than kmalloc/kzalloc + memcpy, which the programmer needs to write the size twice (sometimes lead to mistakes), kmemdup improves readability, leads to smaller code and also reduce the chances of mistakes. Suggestion to use kmemdup rather than using kmalloc/kzalloc + memcpy. Signed-off-by: Fuqian Huang Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/em28xx/em28xx-cards.c | 3 +-- drivers/media/usb/zr364xx/zr364xx.c | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) --- diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index 1283c7ca9ad5..6e33782c3ca6 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -3566,13 +3566,12 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, static int em28xx_duplicate_dev(struct em28xx *dev) { int nr; - struct em28xx *sec_dev = kzalloc(sizeof(*sec_dev), GFP_KERNEL); + struct em28xx *sec_dev = kmemdup(dev, sizeof(*sec_dev), GFP_KERNEL); if (!sec_dev) { dev->dev_next = NULL; return -ENOMEM; } - memcpy(sec_dev, dev, sizeof(*sec_dev)); /* Check to see next free device and mark as used */ do { nr = find_first_zero_bit(em28xx_devused, EM28XX_MAXBOARDS); diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c index b8e89d550d29..637962825d7a 100644 --- a/drivers/media/usb/zr364xx/zr364xx.c +++ b/drivers/media/usb/zr364xx/zr364xx.c @@ -197,12 +197,10 @@ static int send_control_msg(struct usb_device *udev, u8 request, u16 value, { int status; - unsigned char *transfer_buffer = kmalloc(size, GFP_KERNEL); + unsigned char *transfer_buffer = kmemdup(cp, size, GFP_KERNEL); if (!transfer_buffer) return -ENOMEM; - memcpy(transfer_buffer, cp, size); - status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), request, ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_tree/master] media: rc: imon-rsc keymap has incorrect mappings
This is an automatic generated email to let you know that the following patch were queued: Subject: media: rc: imon-rsc keymap has incorrect mappings Author: Sean Young Date:Tue Aug 13 08:19:11 2019 -0300 KEY_MAX is not a key but designates the highest value a linux keycode can ever have. Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab drivers/media/rc/keymaps/rc-imon-rsc.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) --- diff --git a/drivers/media/rc/keymaps/rc-imon-rsc.c b/drivers/media/rc/keymaps/rc-imon-rsc.c index 6f7ee4859682..38787dd0e4a0 100644 --- a/drivers/media/rc/keymaps/rc-imon-rsc.c +++ b/drivers/media/rc/keymaps/rc-imon-rsc.c @@ -7,7 +7,8 @@ // // Note that this remote has a stick which its own IR protocol, -// with 16 directions. This is not supported yet. +// with 16 directions. This is supported by the imon_rsc BPF decoder +// in v4l-utils. // static struct rc_map_table imon_rsc[] = { { 0x801010, KEY_EXIT }, @@ -25,7 +26,7 @@ static struct rc_map_table imon_rsc[] = { { 0x80105c, KEY_NUMERIC_9 }, { 0x801081, KEY_SCREEN }, /* Desktop */ { 0x80105d, KEY_NUMERIC_0 }, - { 0x801082, KEY_MAX }, + { 0x801082, KEY_ZOOM }, /* Maximise */ { 0x801048, KEY_ESC }, { 0x80104b, KEY_MEDIA },/* Windows key */ { 0x801083, KEY_MENU }, @@ -52,7 +53,7 @@ static struct rc_map_table imon_rsc[] = { { 0x80104e, KEY_STOP }, { 0x801052, KEY_REWIND }, { 0x801053, KEY_FASTFORWARD }, - { 0x801089, KEY_ZOOM } /* full screen */ + { 0x801089, KEY_FULL_SCREEN } /* full screen */ }; static struct rc_map_list imon_rsc_map = { ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_tree/master] media: imon_raw: simplify and explain bit operations
This is an automatic generated email to let you know that the following patch were queued: Subject: media: imon_raw: simplify and explain bit operations Author: Sean Young Date:Fri Aug 9 18:47:41 2019 -0300 This code needs some explanation. Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab drivers/media/rc/imon_raw.c | 43 ++- 1 file changed, 34 insertions(+), 9 deletions(-) --- diff --git a/drivers/media/rc/imon_raw.c b/drivers/media/rc/imon_raw.c index 25e56c5b13c0..e6723993b466 100644 --- a/drivers/media/rc/imon_raw.c +++ b/drivers/media/rc/imon_raw.c @@ -14,7 +14,7 @@ struct imon { struct device *dev; struct urb *ir_urb; struct rc_dev *rcdev; - u8 ir_buf[8] __aligned(__alignof__(u64)); + __be64 ir_buf; char phys[64]; }; @@ -29,14 +29,35 @@ struct imon { static void imon_ir_data(struct imon *imon) { struct ir_raw_event rawir = {}; - u64 d = be64_to_cpup((__be64 *)imon->ir_buf) >> 24; + u64 data = be64_to_cpu(imon->ir_buf); + u8 packet_no = data & 0xff; int offset = 40; int bit; - dev_dbg(imon->dev, "data: %*ph", 8, imon->ir_buf); + if (packet_no == 0xff) + return; + + dev_dbg(imon->dev, "data: %*ph", 8, >ir_buf); + + /* +* Only the first 5 bytes contain IR data. Right shift so we move +* the IR bits to the lower 40 bits. +*/ + data >>= 24; do { - bit = fls64(d & (BIT_ULL(offset) - 1)); + /* +* Find highest set bit which is less or equal to offset +* +* offset is the bit above (base 0) where we start looking. +* +* data & (BIT_ULL(offset) - 1) masks off any unwanted bits, +* so we have just bits less than offset. +* +* fls will tell us the highest bit set plus 1 (or 0 if no +* bits are set). +*/ + bit = fls64(data & (BIT_ULL(offset) - 1)); if (bit < offset) { dev_dbg(imon->dev, "pulse: %d bits", offset - bit); rawir.pulse = true; @@ -49,7 +70,12 @@ static void imon_ir_data(struct imon *imon) offset = bit; } - bit = fls64(~d & (BIT_ULL(offset) - 1)); + /* +* Find highest clear bit which is less than offset. +* +* Just invert the data and use same trick as above. +*/ + bit = fls64(~data & (BIT_ULL(offset) - 1)); dev_dbg(imon->dev, "space: %d bits", offset - bit); rawir.pulse = false; @@ -59,7 +85,7 @@ static void imon_ir_data(struct imon *imon) offset = bit; } while (offset > 0); - if (imon->ir_buf[7] == 0x0a) { + if (packet_no == 0x0a) { ir_raw_event_set_idle(imon->rcdev, true); ir_raw_event_handle(imon->rcdev); } @@ -72,8 +98,7 @@ static void imon_ir_rx(struct urb *urb) switch (urb->status) { case 0: - if (imon->ir_buf[7] != 0xff) - imon_ir_data(imon); + imon_ir_data(imon); break; case -ECONNRESET: case -ENOENT: @@ -129,7 +154,7 @@ static int imon_probe(struct usb_interface *intf, imon->dev = >dev; usb_fill_int_urb(imon->ir_urb, udev, usb_rcvintpipe(udev, ir_ep->bEndpointAddress), -imon->ir_buf, sizeof(imon->ir_buf), +>ir_buf, sizeof(imon->ir_buf), imon_ir_rx, imon, ir_ep->bInterval); rcdev = devm_rc_allocate_device(>dev, RC_DRIVER_IR_RAW); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_tree/master] media: media/tuners: Use kmemdup rather than duplicating its implementation
This is an automatic generated email to let you know that the following patch were queued: Subject: media: media/tuners: Use kmemdup rather than duplicating its implementation Author: Fuqian Huang Date:Wed Jul 3 13:28:48 2019 -0300 kmemdup is introduced to duplicate a region of memory in a neat way. Rather than kmalloc/kzalloc + memcpy, which the programmer needs to write the size twice (sometimes lead to mistakes), kmemdup improves readability, leads to smaller code and also reduce the chances of mistakes. Suggestion to use kmemdup rather than using kmalloc/kzalloc + memcpy. Signed-off-by: Fuqian Huang Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab drivers/media/tuners/tuner-xc2028.c | 3 +-- drivers/media/tuners/xc4000.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) --- diff --git a/drivers/media/tuners/tuner-xc2028.c b/drivers/media/tuners/tuner-xc2028.c index aa6861dcd3fd..574c3bb135d7 100644 --- a/drivers/media/tuners/tuner-xc2028.c +++ b/drivers/media/tuners/tuner-xc2028.c @@ -381,7 +381,7 @@ static int load_all_firmwares(struct dvb_frontend *fe, goto corrupt; } - priv->firm[n].ptr = kzalloc(size, GFP_KERNEL); + priv->firm[n].ptr = kmemdup(p, size, GFP_KERNEL); if (priv->firm[n].ptr == NULL) { tuner_err("Not enough memory to load firmware file.\n"); rc = -ENOMEM; @@ -394,7 +394,6 @@ static int load_all_firmwares(struct dvb_frontend *fe, type, (unsigned long long)id, size); } - memcpy(priv->firm[n].ptr, p, size); priv->firm[n].type = type; priv->firm[n].id = id; priv->firm[n].size = size; diff --git a/drivers/media/tuners/xc4000.c b/drivers/media/tuners/xc4000.c index 43925e219d81..d9606738ce43 100644 --- a/drivers/media/tuners/xc4000.c +++ b/drivers/media/tuners/xc4000.c @@ -812,7 +812,7 @@ static int xc4000_fwupload(struct dvb_frontend *fe) goto corrupt; } - priv->firm[n].ptr = kzalloc(size, GFP_KERNEL); + priv->firm[n].ptr = kmemdup(p, size, GFP_KERNEL); if (priv->firm[n].ptr == NULL) { printk(KERN_ERR "Not enough memory to load firmware file.\n"); rc = -ENOMEM; @@ -826,7 +826,6 @@ static int xc4000_fwupload(struct dvb_frontend *fe) type, (unsigned long long)id, size); } - memcpy(priv->firm[n].ptr, p, size); priv->firm[n].type = type; priv->firm[n].id = id; priv->firm[n].size = size; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_tree/master] media: rc: add include guard to rc-map.h
This is an automatic generated email to let you know that the following patch were queued: Subject: media: rc: add include guard to rc-map.h Author: Masahiro Yamada Date:Tue Aug 6 04:07:38 2019 -0300 Add a header include guard just in case. Signed-off-by: Masahiro Yamada Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab include/media/rc-map.h | 5 + 1 file changed, 5 insertions(+) --- diff --git a/include/media/rc-map.h b/include/media/rc-map.h index 3a7f8728f6ec..32e49dcd1348 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -5,6 +5,9 @@ * Copyright (c) 2010 by Mauro Carvalho Chehab */ +#ifndef _MEDIA_RC_MAP_H +#define _MEDIA_RC_MAP_H + #include #include @@ -274,3 +277,5 @@ struct rc_map *rc_map_get(const char *name); * Please, do not just append newer Remote Controller names at the end. * The names should be ordered in alphabetical order */ + +#endif /* _MEDIA_RC_MAP_H */ ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_tree/master] media: stv0900_core: remove redundant assignment to variables mclk, div and ad_div
This is an automatic generated email to let you know that the following patch were queued: Subject: media: stv0900_core: remove redundant assignment to variables mclk, div and ad_div Author: Colin Ian King Date:Fri Jul 5 05:51:32 2019 -0300 The variables mclk, div and ad_div are being assigned with a values that are never read and are being updated later with a new values. The assignments are redundant and can be removed. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab drivers/media/dvb-frontends/stv0900_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/dvb-frontends/stv0900_core.c b/drivers/media/dvb-frontends/stv0900_core.c index 0c50740e7bb8..7d93a1617e86 100644 --- a/drivers/media/dvb-frontends/stv0900_core.c +++ b/drivers/media/dvb-frontends/stv0900_core.c @@ -270,7 +270,7 @@ static enum fe_stv0900_error stv0900_initialize(struct stv0900_internal *intp) static u32 stv0900_get_mclk_freq(struct stv0900_internal *intp, u32 ext_clk) { - u32 mclk = 9000, div = 0, ad_div = 0; + u32 mclk, div, ad_div; div = stv0900_get_bits(intp, F0900_M_DIV); ad_div = ((stv0900_get_bits(intp, F0900_SELX1RATIO) == 1) ? 4 : 6); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_tree/master] media: rc: imon: Allow iMON RC protocol for ffdc 7e device
This is an automatic generated email to let you know that the following patch were queued: Subject: media: rc: imon: Allow iMON RC protocol for ffdc 7e device Author: Darius Rad Date:Tue Jul 23 13:37:46 2019 -0300 Allow selecting the IR protocol, MCE or iMON, for a device that identifies as follows (with config id 0x7e): 15c2:ffdc SoundGraph Inc. iMON PAD Remote Controller As the driver is structured to default to iMON when both RC protocols are supported, existing users of this device (using MCE protocol) will need to manually switch to MCE (RC-6) protocol from userspace (with ir-keytable, sysfs). Signed-off-by: Darius Rad Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab drivers/media/rc/imon.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) --- diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 7bee72108b0e..37a850421fbb 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -1826,12 +1826,17 @@ static void imon_get_ffdc_type(struct imon_context *ictx) break; /* iMON VFD, MCE IR */ case 0x46: - case 0x7e: case 0x9e: dev_info(ictx->dev, "0xffdc iMON VFD, MCE IR"); detected_display_type = IMON_DISPLAY_TYPE_VFD; allowed_protos = RC_PROTO_BIT_RC6_MCE; break; + /* iMON VFD, iMON or MCE IR */ + case 0x7e: + dev_info(ictx->dev, "0xffdc iMON VFD, iMON or MCE IR"); + detected_display_type = IMON_DISPLAY_TYPE_VFD; + allowed_protos |= RC_PROTO_BIT_RC6_MCE; + break; /* iMON LCD, MCE IR */ case 0x9f: dev_info(ictx->dev, "0xffdc iMON LCD, MCE IR"); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_tree/master] media: em28xx: modules workqueue not inited for 2nd device
This is an automatic generated email to let you know that the following patch were queued: Subject: media: em28xx: modules workqueue not inited for 2nd device Author: Sean Young Date:Sun Aug 11 02:05:51 2019 -0300 syzbot reports an error on flush_request_modules() for the second device. This workqueue was never initialised so simply remove the offending line. usb 1-1: USB disconnect, device number 2 em28xx 1-1:1.153: Disconnecting em28xx #1 [ cut here ] WARNING: CPU: 0 PID: 12 at kernel/workqueue.c:3031 __flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031 Kernel panic - not syncing: panic_on_warn set ... CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.3.0-rc2+ #25 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: usb_hub_wq hub_event Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xca/0x13e lib/dump_stack.c:113 panic+0x2a3/0x6da kernel/panic.c:219 __warn.cold+0x20/0x4a kernel/panic.c:576 report_bug+0x262/0x2a0 lib/bug.c:186 fixup_bug arch/x86/kernel/traps.c:179 [inline] fixup_bug arch/x86/kernel/traps.c:174 [inline] do_error_trap+0x12b/0x1e0 arch/x86/kernel/traps.c:272 do_invalid_op+0x32/0x40 arch/x86/kernel/traps.c:291 invalid_op+0x23/0x30 arch/x86/entry/entry_64.S:1026 RIP: 0010:__flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031 Code: 9a 22 00 48 c7 c7 20 e4 c5 85 e8 d9 3a 0d 00 0f 0b 45 31 e4 e9 98 86 ff ff e8 51 9a 22 00 48 c7 c7 20 e4 c5 85 e8 be 3a 0d 00 <0f> 0b 45 31 e4 e9 7d 86 ff ff e8 36 9a 22 00 48 c7 c7 20 e4 c5 85 RSP: 0018:8881da20f720 EFLAGS: 00010286 RAX: 0024 RBX: dc00 RCX: RDX: RSI: 8128a0fd RDI: ed103b441ed6 RBP: 8881da20f888 R08: 0024 R09: fbfff11acd9a R10: fbfff11acd99 R11: 88d66ccf R12: R13: 0001 R14: 8881c6685df8 R15: 8881d2a85b78 flush_request_modules drivers/media/usb/em28xx/em28xx-cards.c:3325 [inline] em28xx_usb_disconnect.cold+0x280/0x2a6 drivers/media/usb/em28xx/em28xx-cards.c:4023 usb_unbind_interface+0x1bd/0x8a0 drivers/usb/core/driver.c:423 __device_release_driver drivers/base/dd.c:1120 [inline] device_release_driver_internal+0x404/0x4c0 drivers/base/dd.c:1151 bus_remove_device+0x2dc/0x4a0 drivers/base/bus.c:556 device_del+0x420/0xb10 drivers/base/core.c:2288 usb_disable_device+0x211/0x690 drivers/usb/core/message.c:1237 usb_disconnect+0x284/0x8d0 drivers/usb/core/hub.c:2199 hub_port_connect drivers/usb/core/hub.c:4949 [inline] hub_port_connect_change drivers/usb/core/hub.c:5213 [inline] port_event drivers/usb/core/hub.c:5359 [inline] hub_event+0x1454/0x3640 drivers/usb/core/hub.c:5441 process_one_work+0x92b/0x1530 kernel/workqueue.c:2269 process_scheduled_works kernel/workqueue.c:2331 [inline] worker_thread+0x7ab/0xe20 kernel/workqueue.c:2417 kthread+0x318/0x420 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 Kernel Offset: disabled Rebooting in 86400 seconds.. Fixes: be7fd3c3a8c5e ("media: em28xx: Hauppauge DualHD second tuner functionality) Reviewed-by: Ezequiel Garcia Reviewed-by: Brad Love Reported-by: syzbot+b7f57261c521087d8...@syzkaller.appspotmail.com Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/em28xx/em28xx-cards.c | 1 - 1 file changed, 1 deletion(-) --- diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index 6e33782c3ca6..5983e72a0622 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -4019,7 +4019,6 @@ static void em28xx_usb_disconnect(struct usb_interface *intf) dev->dev_next->disconnected = 1; dev_info(>intf->dev, "Disconnecting %s\n", dev->dev_next->name); - flush_request_modules(dev->dev_next); } dev->disconnected = 1; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] v4l-utils: sync with media_tree master
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: v4l-utils: sync with media_tree master Author: Sean Young Date:Wed Aug 14 10:35:23 2019 +0100 Signed-off-by: Sean Young utils/keytable/parse.h| 9 - utils/keytable/rc_keymaps/imon_rsc.toml | 4 ++-- utils/keytable/rc_keymaps_userspace/imon_rsc.toml | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=59d6c0b4a5605b4dbb4020f3b9cba7de87d9fdce diff --git a/utils/keytable/parse.h b/utils/keytable/parse.h index a78d86dcfddc..e08dfbc657fe 100644 --- a/utils/keytable/parse.h +++ b/utils/keytable/parse.h @@ -151,6 +151,7 @@ struct parse_event key_events[] = { {"KEY_SCALE", 120}, {"KEY_KPCOMMA", 121}, {"KEY_HANGEUL", 122}, + {"KEY_HANGUEL", 122}, {"KEY_HANJA", 123}, {"KEY_YEN", 124}, {"KEY_LEFTMETA", 125}, @@ -181,7 +182,9 @@ struct parse_event key_events[] = { {"KEY_WWW", 150}, {"KEY_MSDOS", 151}, {"KEY_COFFEE", 152}, + {"KEY_SCREENLOCK", 152}, {"KEY_ROTATE_DISPLAY", 153}, + {"KEY_DIRECTION", 153}, {"KEY_CYCLEWINDOWS", 154}, {"KEY_MAIL", 155}, {"KEY_BOOKMARKS", 156}, @@ -268,8 +271,10 @@ struct parse_event key_events[] = { {"KEY_VIDEO_PREV", 242}, {"KEY_BRIGHTNESS_CYCLE", 243}, {"KEY_BRIGHTNESS_AUTO", 244}, + {"KEY_BRIGHTNESS_ZERO", 244}, {"KEY_DISPLAY_OFF", 245}, {"KEY_WWAN", 246}, + {"KEY_WIMAX", 246}, {"KEY_RFKILL", 247}, {"KEY_MICMUTE", 248}, {"BTN_MISC", 0x100}, @@ -363,9 +368,11 @@ struct parse_event key_events[] = { {"KEY_SUBTITLE", 0x172}, {"KEY_ANGLE", 0x173}, {"KEY_FULL_SCREEN", 0x174}, + {"KEY_ZOOM", 0x174}, {"KEY_MODE", 0x175}, {"KEY_KEYBOARD", 0x176}, {"KEY_ASPECT_RATIO", 0x177}, + {"KEY_SCREEN", 0x177}, {"KEY_PC", 0x178}, {"KEY_TV", 0x179}, {"KEY_TV2", 0x17a}, @@ -422,6 +429,7 @@ struct parse_event key_events[] = { {"KEY_ADDRESSBOOK", 0x1ad}, {"KEY_MESSENGER", 0x1ae}, {"KEY_DISPLAYTOGGLE", 0x1af}, + {"KEY_BRIGHTNESS_TOGGLE", 0x1af}, {"KEY_SPELLCHECK", 0x1b0}, {"KEY_LOGOFF", 0x1b1}, {"KEY_DOLLAR", 0x1b2}, @@ -582,7 +590,6 @@ struct parse_event key_events[] = { {"BTN_TRIGGER_HAPPY38", 0x2e5}, {"BTN_TRIGGER_HAPPY39", 0x2e6}, {"BTN_TRIGGER_HAPPY40", 0x2e7}, - {"KEY_MAX", 0x2ff}, { NULL, 0} }; struct parse_event rel_events[] = { diff --git a/utils/keytable/rc_keymaps/imon_rsc.toml b/utils/keytable/rc_keymaps/imon_rsc.toml index 4f20a54e50a7..173028c7a494 100644 --- a/utils/keytable/rc_keymaps/imon_rsc.toml +++ b/utils/keytable/rc_keymaps/imon_rsc.toml @@ -18,7 +18,7 @@ variant = "necx" 0x80105c = "KEY_NUMERIC_9" 0x801081 = "KEY_SCREEN" 0x80105d = "KEY_NUMERIC_0" -0x801082 = "KEY_MAX" +0x801082 = "KEY_ZOOM" 0x801048 = "KEY_ESC" 0x80104b = "KEY_MEDIA" 0x801083 = "KEY_MENU" @@ -45,6 +45,6 @@ variant = "necx" 0x80104e = "KEY_STOP" 0x801052 = "KEY_REWIND" 0x801053 = "KEY_FASTFORWARD" -0x801089 = "KEY_ZOOM" +0x801089 = "KEY_FULL_SCREEN" [[protocols]] protocol = "imon_rsc" diff --git a/utils/keytable/rc_keymaps_userspace/imon_rsc.toml b/utils/keytable/rc_keymaps_userspace/imon_rsc.toml index 4f20a54e50a7..173028c7a494 100644 --- a/utils/keytable/rc_keymaps_userspace/imon_rsc.toml +++ b/utils/keytable/rc_keymaps_userspace/imon_rsc.toml @@ -18,7 +18,7 @@ variant = "necx" 0x80105c = "KEY_NUMERIC_9" 0x801081 = "KEY_SCREEN" 0x80105d = "KEY_NUMERIC_0" -0x801082 = "KEY_MAX" +0x801082 = "KEY_ZOOM" 0x801048 = "KEY_ESC" 0x80104b = "KEY_MEDIA" 0x801083 = "KEY_MENU" @@ -45,6 +45,6 @@ variant = "necx" 0x80104e = "KEY_STOP" 0x801052 = "KEY_REWIND" 0x801053 = "KEY_FASTFORWARD" -0x801089 = "KEY_ZOOM" +0x801089 = "KEY_FULL_SCREEN" [[protocols]] protocol = "imon_rsc" ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_tree/master] media: vsp1: fix memory leak of dl on error return path
This is an automatic generated email to let you know that the following patch were queued: Subject: media: vsp1: fix memory leak of dl on error return path Author: Colin Ian King Date:Sun Jul 28 14:11:24 2019 -0300 Currently when the call vsp1_dl_body_get fails and returns null the error return path leaks the allocation of dl. Fix this by kfree'ing dl before returning. Addresses-Coverity: ("Resource leak") Fixes: 5d7936b8e27d ("media: vsp1: Convert display lists to use new body pool") Signed-off-by: Colin Ian King Reviewed-by: Kieran Bingham Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/vsp1/vsp1_dl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- diff --git a/drivers/media/platform/vsp1/vsp1_dl.c b/drivers/media/platform/vsp1/vsp1_dl.c index 104b6f514536..d7b43037e500 100644 --- a/drivers/media/platform/vsp1/vsp1_dl.c +++ b/drivers/media/platform/vsp1/vsp1_dl.c @@ -557,8 +557,10 @@ static struct vsp1_dl_list *vsp1_dl_list_alloc(struct vsp1_dl_manager *dlm) /* Get a default body for our list. */ dl->body0 = vsp1_dl_body_get(dlm->pool); - if (!dl->body0) + if (!dl->body0) { + kfree(dl); return NULL; + } header_offset = dl->body0->max_entries * sizeof(*dl->body0->entries); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits