1. 21 Dec, 2015 1 commit
    • Mauro Carvalho Chehab's avatar
      [media] ir-lirc-codec.c: don't leak lirc->drv-rbuf · c77adf21
      Mauro Carvalho Chehab authored
      As reported by kmemleak:
      
      	unreferenced object 0xffff8802adae0ba0 (size 192):
      	  comm "modprobe", pid 3024, jiffies 4296503588 (age 324.368s)
      	  hex dump (first 32 bytes):
      	    00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00  .....N..........
      	    ff ff ff ff ff ff ff ff c0 48 25 a0 ff ff ff ff  .........H%.....
      	  backtrace:
      	    [<ffffffff82278c8e>] kmemleak_alloc+0x4e/0xb0
      	    [<ffffffff8153c08c>] kmem_cache_alloc_trace+0x1ec/0x280
      	    [<ffffffffa0250f0d>] ir_lirc_register+0x8d/0x7a0 [ir_lirc_codec]
      	    [<ffffffffa07372b8>] ir_raw_event_register+0x318/0x4b0 [rc_core]
      	    [<ffffffffa07351ed>] rc_register_device+0xf2d/0x1450 [rc_core]
      	    [<ffffffffa13c5451>] au0828_rc_register+0x7d1/0xa10 [au0828]
      	    [<ffffffffa13b0dc2>] au0828_usb_probe+0x6c2/0xcf0 [au0828]
      	    [<ffffffff81d7619d>] usb_probe_interface+0x45d/0x940
      	    [<ffffffff81ca7004>] driver_probe_device+0x454/0xd90
      	    [<ffffffff81ca7a61>] __driver_attach+0x121/0x160
      	    [<ffffffff81ca141f>] bus_for_each_dev+0x11f/0x1a0
      	    [<ffffffff81ca5d4d>] driver_attach+0x3d/0x50
      	    [<ffffffff81ca5039>] bus_add_driver+0x4c9/0x770
      	    [<ffffffff81ca944c>] driver_register+0x18c/0x3b0
      	    [<ffffffff81d71e58>] usb_register_driver+0x1f8/0x440
      	    [<ffffffffa13680b7>] 0xffffffffa13680b7
      
      	0xf3d is in ir_lirc_register (drivers/media/rc/ir-lirc-codec.c:348).
      	343		drv = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
      	344		if (!drv)
      	345			return rc;
      	346
      	347		rbuf = kzalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
      	348		if (!rbuf)
      	349			goto rbuf_alloc_failed;
      	350
      	351		rc = lirc_buffer_init(rbuf, sizeof(int), LIRCBUF_SIZE);
      	352		if (rc)
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      c77adf21
  2. 18 Dec, 2015 31 commits
  3. 12 Dec, 2015 1 commit
  4. 04 Dec, 2015 4 commits
  5. 03 Dec, 2015 3 commits
    • Arnd Bergmann's avatar
      [media] staging: media: lirc: Replace timeval with ktime_t in lirc_parallel.c · 0dbf41a3
      Arnd Bergmann authored
      'struct timeval tv' and 'struct timeval now' is used to calculate the
      elapsed time. 'LIRC_SFH506_DELAY' is a delay t_phl in usecs.
      
      32-bit systems using 'struct timeval' will break in the year 2038,
      so we have to replace that code with more appropriate types.
      This patch changes the lirc_parallel.c file of  media: lirc driver
      to use ktime_t.
      
      ktime_get() is  better than using do_gettimeofday(),
      because it uses the monotonic clock. ktime_sub is used
      to subtract two ktime variables. ktime_to_us() is used to
      convert ktime to microsecond.
      
      New ktime_t variable timeout, is added in lirc_off(),to improve
      clarity. Introduced a new ktime_t variable in lirc_lirc_irq_handler()
      function, to avoid the use of signal variable for storing
      seconds in the first part of this function as later it uses
      a time unit that is defined by the global "timer" variable.
      This makes it more clear.
      
      ktime_set() is used to set a value in seconds to a value in
      nanosecond so that ktime_compare() can be used appropriately.
      ktime_compare() is used to compare two ktime values.
      ktime_add_ns() is used to increment a ktime value by 1 sec.
      
      One comment is also shifted a line up, as it was creating a 80
      character warning.
      
      Build tested it. Also tested it with sparse.
      Signed-off-by: default avatarTapasweni Pathak <tapaswenipathak@gmail.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      0dbf41a3
    • Arnd Bergmann's avatar
      [media] staging: media: lirc: Replace timeval with ktime_t in lirc_sasem.c · f07c73fe
      Arnd Bergmann authored
      'struct timeval presstime' and 'struct timeval tv' is used to
      calculate the time since the last button press.
      
      32-bit systems using 'struct timeval' will break in the year 2038,
      so we have to replace that code with more appropriate types.
      This patch changes the media: lirc driver to use ktime_t.
      
      ktime_get() is  better than using do_gettimeofday(), because it uses
      the monotonic clock. ktime_sub() are used to subtract two ktime
      variables. 'ms' is only used to check how much time has passed by comparing
      to 250. So instead of using expensive ktime_to_ms() call, it has been
      changed to hold nanoseconds by using ktime_to_ns().
      
      Build tested it. Tested with sparse too.
      Signed-off-by: default avatarTapasweni Pathak <tapaswenipathak@gmail.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      f07c73fe
    • Arnd Bergmann's avatar
      [media] staging: media: lirc: Replace timeval with ktime_t in lirc_serial.c · 84595032
      Arnd Bergmann authored
      'struct timeval tv' is used to get current time.
      'static struct timeval lasttv' is used to get last interrupt time.
      
      32-bit systems using 'struct timeval' will break in the year 2038,
      so we have to replace that code with more appropriate types.
      This patch changes the lirc_serial.c file of media: lirc to use
      ktime_t.
      
      ktime_get() is  better than using do_gettimeofday(),
      because it uses the monotonic clock. ktime_sub is used
      to subtract two ktime variables. The check to test time
      going backwards is also removed. Intialization to static
      variable is also removed. ktime_to_us() is used to convert
      ktime_t to microsecond value. deltv is changed to delkt, a
      ktime_t type varibale from long to assign the ktime_sub value
      directly. ktime_compare is used to compare delkt with 15
      seconds, which is changed to a nanosecond value by using
      ktime_set().
      
      Build tested it.
      Signed-off-by: default avatarTapasweni Pathak <tapaswenipathak@gmail.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      84595032