[PATCH v3] [media] au8522: Avoid memory leak for device config data

2015-12-21 Thread Mauro Carvalho Chehab
As reported by kmemleak:

unreferenced object 0x880321e1da40 (size 32):
  comm "modprobe", pid 3309, jiffies 4295019569 (age 2359.636s)
  hex dump (first 32 bytes):
47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  G...
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
  backtrace:
[] kmemleak_alloc+0x4e/0xb0
[] kmem_cache_alloc_trace+0x1ec/0x280
[] au8522_probe+0x19a/0xa30 [au8522_decoder]
[] i2c_device_probe+0x2b2/0x490
[] driver_probe_device+0x454/0xd90
[] __device_attach_driver+0x17b/0x230
[] bus_for_each_drv+0x11a/0x1b0
[] __device_attach+0x1cd/0x2c0
[] device_initial_probe+0x13/0x20
[] bus_probe_device+0x1af/0x250
[] device_add+0x943/0x13b0
[] device_register+0x1a/0x20
[] i2c_new_device+0x5d6/0x8f0
[] v4l2_i2c_new_subdev_board+0x1e4/0x250 
[v4l2_common]
[] v4l2_i2c_new_subdev+0xd7/0x110 [v4l2_common]
[] au0828_card_analog_fe_setup+0x2e6/0x3f0 
[au0828]

Checking where the error happens:
(gdb) list *au8522_probe+0x19a
0x99a is in au8522_probe 
(drivers/media/dvb-frontends/au8522_decoder.c:761).
756 printk(KERN_INFO "au8522_decoder attach 
existing instance.\n");
757 break;
758 }
759
760 demod_config = kzalloc(sizeof(struct au8522_config), 
GFP_KERNEL);
761 if (demod_config == NULL) {
762 if (instance == 1)
763 kfree(state);
764 return -ENOMEM;
765 }

Shows that the error path is not being handled properly.

The are actually several issues here:

1) config free should have been calling hybrid_tuner_release_state()
function, by calling au8522_release_state();

2) config is only allocated at the digital part. On the analog one,
it is received from the caller.

A complex logic could be added to address it, however, it is simpler
to just embeed config inside the state.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/dvb-frontends/au8522_common.c  | 10 +-
 drivers/media/dvb-frontends/au8522_decoder.c | 14 ++
 drivers/media/dvb-frontends/au8522_dig.c | 16 
 drivers/media/dvb-frontends/au8522_priv.h|  2 +-
 4 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/drivers/media/dvb-frontends/au8522_common.c 
b/drivers/media/dvb-frontends/au8522_common.c
index 3559ff230045..f135126bc373 100644
--- a/drivers/media/dvb-frontends/au8522_common.c
+++ b/drivers/media/dvb-frontends/au8522_common.c
@@ -44,7 +44,7 @@ int au8522_writereg(struct au8522_state *state, u16 reg, u8 
data)
int ret;
u8 buf[] = { (reg >> 8) | 0x80, reg & 0xff, data };
 
-   struct i2c_msg msg = { .addr = state->config->demod_address,
+   struct i2c_msg msg = { .addr = state->config.demod_address,
   .flags = 0, .buf = buf, .len = 3 };
 
ret = i2c_transfer(state->i2c, , 1);
@@ -64,9 +64,9 @@ u8 au8522_readreg(struct au8522_state *state, u16 reg)
u8 b1[] = { 0 };
 
struct i2c_msg msg[] = {
-   { .addr = state->config->demod_address, .flags = 0,
+   { .addr = state->config.demod_address, .flags = 0,
  .buf = b0, .len = 2 },
-   { .addr = state->config->demod_address, .flags = I2C_M_RD,
+   { .addr = state->config.demod_address, .flags = I2C_M_RD,
  .buf = b1, .len = 1 } };
 
ret = i2c_transfer(state->i2c, msg, 2);
@@ -140,7 +140,7 @@ EXPORT_SYMBOL(au8522_release_state);
 
 static int au8522_led_gpio_enable(struct au8522_state *state, int onoff)
 {
-   struct au8522_led_config *led_config = state->config->led_cfg;
+   struct au8522_led_config *led_config = state->config.led_cfg;
u8 val;
 
/* bail out if we can't control an LED */
@@ -170,7 +170,7 @@ static int au8522_led_gpio_enable(struct au8522_state 
*state, int onoff)
  */
 int au8522_led_ctrl(struct au8522_state *state, int led)
 {
-   struct au8522_led_config *led_config = state->config->led_cfg;
+   struct au8522_led_config *led_config = state->config.led_cfg;
int i, ret = 0;
 
/* bail out if we can't control an LED */
diff --git a/drivers/media/dvb-frontends/au8522_decoder.c 
b/drivers/media/dvb-frontends/au8522_decoder.c
index 28d7dc2fee34..c8f13d8370e5 100644
--- a/drivers/media/dvb-frontends/au8522_decoder.c
+++ b/drivers/media/dvb-frontends/au8522_decoder.c
@@ -730,7 +730,6 @@ static int au8522_probe(struct i2c_client *client,
struct v4l2_ctrl_handler *hdl;
struct v4l2_subdev *sd;
int instance;
-   struct au8522_config *demod_config;
 

Raw ATSC Stream Capture

2015-12-21 Thread Thomás Inskip
Hi.

I do not know whether this is the appropriate forum for my question,
but as I cannot find a more suitable one, here it goes:

I have successfully built and installed the drivers using the
media_build distribution, as I have a slightly older kernel.  The
driver modules are loading correctly, and I'm able to w_scan and play
back live terrestrial ATSC TV using VLC.  However, what I really need
for my project is access to the raw ATSC MPEG2-TS, Ideally being able
to just read it from a device node.  I have tried various incantations
of v4l2-ctl without success, and have not been able to find any help
on how to do this online.  Could someone please send me some info on
how to do this, or at least point me in the right direction?

Oh, I'm using a Hauppauge HDR-955Q tuner.

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Raw ATSC Stream Capture

2015-12-21 Thread Steven Toth
> on how to do this online.  Could someone please send me some info on
> how to do this, or at least point me in the right direction?
>
> Oh, I'm using a Hauppauge HDR-955Q tuner.

v4l2-ctl isn't used for ATSC transmissions, its generally used for
analog TV only.

Take a look at the 'azap' and 'dvbtraffic' tools. These are what you need.

-- 
Steven Toth - Kernel Labs
http://www.kernellabs.com
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Raw ATSC Stream Capture

2015-12-21 Thread Thomás Inskip
Thank you.  scan + azap did exactly what I needed.


On Mon, Dec 21, 2015 at 10:31 AM, Steven Toth  wrote:
>> on how to do this online.  Could someone please send me some info on
>> how to do this, or at least point me in the right direction?
>>
>> Oh, I'm using a Hauppauge HDR-955Q tuner.
>
> v4l2-ctl isn't used for ATSC transmissions, its generally used for
> analog TV only.
>
> Take a look at the 'azap' and 'dvbtraffic' tools. These are what you need.
>
> --
> Steven Toth - Kernel Labs
> http://www.kernellabs.com
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] media: i2c: ov2659: speedup probe if no device connected

2015-12-21 Thread Grygorii Strashko
The ov2659 driver performs device detection and initialization in the
following way:
 - send reset command REG_SOFTWARE_RESET
 - load array of predefined register's setting (~150 values)
 - read device version REG_SC_CHIP_ID_H/REG_SC_CHIP_ID_L
 - check version and exit if invalid.

As result, for not connected device there will be >~150 i2c transactions
executed before device version checking and exit (there are no
failures detected because ov2659 declared as I2C_CLIENT_SCCB and NACKs
are ignored in this case).

Let's fix that by checking the chip version first and start
initialization only if it's supported.

Cc: Benoit Parrot 
Signed-off-by: Grygorii Strashko 
---
 drivers/media/i2c/ov2659.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c
index 49109f4..9b7b78c 100644
--- a/drivers/media/i2c/ov2659.c
+++ b/drivers/media/i2c/ov2659.c
@@ -1321,10 +1321,6 @@ static int ov2659_detect(struct v4l2_subdev *sd)
}
usleep_range(1000, 2000);
 
-   ret = ov2659_init(sd, 0);
-   if (ret < 0)
-   return ret;
-
/* Check sensor revision */
ret = ov2659_read(client, REG_SC_CHIP_ID_H, );
if (!ret)
@@ -1338,8 +1334,10 @@ static int ov2659_detect(struct v4l2_subdev *sd)
dev_err(>dev,
"Sensor detection failed (%04X, %d)\n",
id, ret);
-   else
+   else {
dev_info(>dev, "Found OV%04X sensor\n", id);
+   ret = ov2659_init(sd, 0);
+   }
}
 
return ret;
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Sabrent (stk1160) / Easycap driver problem

2015-12-21 Thread Ezequiel Garcia
Hi Philippe,

On 20 December 2015 at 20:32, Philippe Desrochers
 wrote:
> Hello Ezequiel,
>
> I tested with saa7115.c and the problem is in the "saa711x_detect_chip"
> function.
> In fact, the CJC7113 chip seems to returns all '1' when reading register 0.
>  ("" found @ 0x4a (stk1160)))
>
> I made a test by returning "SAA7113" without taking care of the value read
> from the CJC7113.
> By doing that, I was able to make the device work with VLC in Ubuntu 14.04.
>

That's good news, isn't it?

> I tried to find the datasheet of this CJC7113 chip but it does not seems to
> be available on the web.
>
> I will contact Sabrent for support and datasheet.
> If I get some positive response I think I will patch the driver otherwise I
> will select another dongle.
>

FWIW, I believe a patch to make CJC7113 detected as SAA7113 would
be acceptable.
-- 
Ezequiel García, VanguardiaSur
www.vanguardiasur.com.ar
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] rtl2832: add support for slave ts pid filter

2015-12-21 Thread Benjamin Larsson

On 12/21/2015 03:42 AM, Antti Palosaari wrote:

Patch looks acceptable, but it is broken in a mean it does not apply :(



I'll rebase on git://linuxtv.org/anttip/media_tree.git rtl2832u_pull.

MvH
Benjamin Larsson


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [media] uvcvideo: Only register media dev if MEDIA_CONTROLLER is defined

2015-12-21 Thread Javier Martinez Canillas
Commit 1590ad7b5271 ("[media] media-device: split media initialization
and registration") split the media dev initialization and registration
but introduced a build error since media_device_register() was called
unconditionally even when the MEDIA_CONTROLLER config was not enabled:

from drivers/media/usb/uvc/uvc_driver.c:14:
   drivers/media/usb/uvc/uvc_driver.c: In function 'uvc_probe':
   drivers/media/usb/uvc/uvc_driver.c:1960:32: error: 'struct uvc_device' has 
no member named 'mdev'
 if (media_device_register(>mdev) < 0)

Fixes: 1590ad7b5271 ("[media] media-device: split media initialization and 
registration")
Reported-by: Fengguang Wu 
Signed-off-by: Javier Martinez Canillas 

---

 drivers/media/usb/uvc/uvc_driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/uvc/uvc_driver.c 
b/drivers/media/usb/uvc/uvc_driver.c
index ddf035a23e3a..599390325c09 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -1957,10 +1957,11 @@ static int uvc_probe(struct usb_interface *intf,
if (uvc_register_chains(dev) < 0)
goto error;
 
+#ifdef CONFIG_MEDIA_CONTROLLER
/* Register the media device node */
if (media_device_register(>mdev) < 0)
goto error;
-
+#endif
/* Save our data pointer in the interface data. */
usb_set_intfdata(intf, dev);
 
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/5] [media] au0828-core: fix compilation when !CONFIG_MEDIA_CONTROLLER

2015-12-21 Thread Javier Martinez Canillas
Hello Mauro,

On 12/16/2015 02:11 PM, Mauro Carvalho Chehab wrote:
> commit 1590ad7b52714 ("[media] media-device: split media initialization
> and registration") moved the media controller register to a
> separate function. That caused the following compilation issue,
> if !CONFIG_MEDIA_CONTROLLER:
> 
> vim +445 drivers/media/usb/au0828/au0828-core.c
> 
>439if (retval) {
>440pr_err("%s() au0282_dev_register failed to 
> create graph\n",
>441   __func__);
>442goto done;
>443}
>444
>  > 445retval = media_device_register(dev->media_dev);
>446
>447done:
>448if (retval < 0)
> 
> Reported-by: kbuild test robot 
> Signed-off-by: Mauro Carvalho Chehab 

Looks good to me, sorry for forgetting to test with !CONFIG_MEDIA_CONTROLLER
and missing this...

Reviewed-by: Javier Martinez Canillas 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 00/23] Unrestricted media entity ID range support

2015-12-21 Thread Javier Martinez Canillas
On 12/16/2015 02:39 PM, Mauro Carvalho Chehab wrote:
> Em Wed, 16 Dec 2015 16:03:01 +0200
> Sakari Ailus  escreveu:
> 
>> Hi Javier,
>>
>> On Wed, Dec 16, 2015 at 03:32:15PM +0200, Sakari Ailus wrote:
>>> This is the third version of the unrestricted media entity ID range
>>> support set. I've taken Mauro's comments into account and fixed a number
>>> of bugs as well (omap3isp memory leak and omap4iss stream start).
> 
> Patches merged on my experimental tree:
> 
>   ssh://linuxtv.org/git/mchehab/experimental.git
> 
> branch media-controller-rc4
> 
> I had to do some rebase, as you were using some older changeset.
> Also, several documentation tags were with troubles (renamed
> vars not renamed there).
> 
> Next time, please check the documentation with:
>   make DOCBOOKS=device-drivers.xml htmldocs 2>&1
> 
>> Javier: Mauro told me you might have OMAP4 hardware. Would you be able to
>> test the OMAP4 ISS with these patches?
> 

Sakari, I used to have an OMAP4 board (OMAP4460 Panda ES) but I don't
have it anymore, only OMAP3 and AM335x boards using TI SoCs for now.

> As Sakari patches were rebased, it would be good to test them again
> on omap3.
>

Mauro, I tested your latest media-controller-rc4 branch that contains
Sakari's patches and both graph enumration and video capture work on
my OMAP3 IGEPv2 board.

> Regards,
> Mauro
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] [media] media-device: handle errors at media_device_init()

2015-12-21 Thread Javier Martinez Canillas
Hello Mauro,

On 12/15/2015 09:22 AM, Mauro Carvalho Chehab wrote:
> Changeset 43ac4401dca9 ("[media] media-device: split media
> initialization and registration") broke media device register
> into two separate functions, but introduced a BUG_ON() and
> made media_device_init() void. It also introduced several
> warnings.
> 
> Instead of adding BUG_ON(), let's revert to WARN_ON() and fix
> the init code in a way that, if something goes wrong during
> device init, driver probe will fail without causing the Kernel
> to BUG.
> 
> Signed-off-by: Mauro Carvalho Chehab 
> ---

I agree with your patch, in fact the first version of the media
split patch did exactly this and later media_device_init() was
converted to void and the BUG_ON() introduced to address some
feedback I got during the patches review.

Reviewed-by: Javier Martinez Canillas 

On an OMAP3 IGEPv2:

Tested-by: Javier Martinez Canillas 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] [media] media-device: split media initialization and registration

2015-12-21 Thread Javier Martinez Canillas
Hello Mauro,

On 12/15/2015 08:13 AM, Mauro Carvalho Chehab wrote:

[snip]

>>>  
>>>  /**
>>> - * media_device_register - register a media device
>>> + * media_device_init() - initialize a media device
>>>   * @mdev:  The media device
>>>   *
>>>   * The caller is responsible for initializing the media device before
>>> @@ -534,12 +534,11 @@ static void media_device_release(struct media_devnode 
>>> *mdev)
>>>   *
>>>   * - dev must point to the parent device
>>>   * - model must be filled with the device model name
>>> + *
>>> + * returns zero on success or a negative error code.
>>>   */
>>> -int __must_check __media_device_register(struct media_device *mdev,
>>> -struct module *owner)
>>> +int __must_check media_device_init(struct media_device *mdev)
>>
>> I think I suggested making media_device_init() return void as the only
>> remaining source of errors would be driver bugs.
>>
>> I'd simply replace the WARN_ON() below with BUG().
> 
> That sounds like bad idea to me, and it is against the current
> Kernel policy of using BUG() only when there's no other way, e. g. on
> event so severe that the Kernel has no other thing to do except to
> stop running.
>

I agree with you, that was exactly my point and what I told Sakari [0] but
he had a strong opinion about it and I didn't mind too much so I decided at
the end to just change it to a BUG_ON() so I could get his ack for this set.
 
> For sure, this is not the case here. Also, all drivers have already
> a logic that checks if the device init happened. So, they should already
> be doing the right thing.
>
> Regards,
> Mauro

[0]: https://lkml.org/lkml/2015/9/10/483

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


cron job: media_tree daily build: OK

2015-12-21 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Tue Dec 22 04:00:13 CET 2015
git branch: test
git hash:   0aff8a894a2be4c22e6414db33061153a4b35bc9
gcc version:i686-linux-gcc (GCC) 5.1.0
sparse version: v0.5.0-51-ga53cea2
smatch version: v0.5.0-3228-g5cf65ab
host hardware:  x86_64
host os:4.2.0-164

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin-bf561: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16.7-i686: OK
linux-3.17.8-i686: OK
linux-3.18.7-i686: OK
linux-3.19-i686: OK
linux-4.0-i686: OK
linux-4.1.1-i686: OK
linux-4.2-i686: OK
linux-4.3-i686: OK
linux-4.4-rc1-i686: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16.7-x86_64: OK
linux-3.17.8-x86_64: OK
linux-3.18.7-x86_64: OK
linux-3.19-x86_64: OK
linux-4.0-x86_64: OK
linux-4.1.1-x86_64: OK
linux-4.2-x86_64: OK
linux-4.3-x86_64: OK
linux-4.4-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Tuesday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Tuesday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[linux-next:master 6315/7948] drivers/media/usb/cx231xx/cx231xx-cards.c:1741:36: error: 'struct cx231xx' has no member named 'media_dev'

2015-12-21 Thread kbuild test robot
Hi Javier,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
master
head:   6fadd3a85f4381c065ca2accbedaa622f83697ad
commit: 1590ad7b52714fddc958189103c95541b49b1dae [6315/7948] [media] 
media-device: split media initialization and registration
config: x86_64-rhel (attached as .config)
reproduce:
git checkout 1590ad7b52714fddc958189103c95541b49b1dae
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/media/usb/cx231xx/cx231xx-cards.c: In function 'cx231xx_usb_probe':
>> drivers/media/usb/cx231xx/cx231xx-cards.c:1741:36: error: 'struct cx231xx' 
>> has no member named 'media_dev'
 retval = media_device_register(dev->media_dev);
   ^
--
   drivers/media/usb/uvc/uvc_driver.c: In function 'uvc_probe':
>> drivers/media/usb/uvc/uvc_driver.c:1960:32: error: 'struct uvc_device' has 
>> no member named 'mdev'
 if (media_device_register(>mdev) < 0)
   ^

vim +1741 drivers/media/usb/cx231xx/cx231xx-cards.c

  1735  request_modules(dev);
  1736  
  1737  retval = cx231xx_create_media_graph(dev);
  1738  if (retval < 0)
  1739  goto done;
  1740  
> 1741  retval = media_device_register(dev->media_dev);
  1742  
  1743  done:
  1744  if (retval < 0)

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH 2/3] mn88472: add work around for failing firmware loading

2015-12-21 Thread Benjamin Larsson

On 12/21/2015 03:52 AM, Antti Palosaari wrote:

Hello
I am not sure if problem is I2C adapter/bus or that demodulator I2C
slave. If it is demod, then that workaround is correct place, but if it
is not, then that is wrong and I2C adapter repeating logic should be used.

I did some testing again... Loading mn88472 firmware 1000 times, it failed:
61 times RC polling disabled
68 times RC polling enabled
83 times RC polling enabled, but repeated failed message due to that patch


At least this confirms there is an issue.



I don't want apply that patch until I find some time myself to examine
that problem - or someone else does some study to point out whats wrong.
There is many things to test in order to get better understanding.

regards
Antti


I do have other hardware with with a mn88472 demod on it. A CX23102 
bridge and a dibcom (Xbox one tuner). I think that running the same test 
on those hardware will tell where the issue is.


I know that Olli have worked on the Xbox one tuner, do you have any 
support patches that could help testing this? And did you observe any 
issues with the mn88472 demod when working on the Xbox one tuner ?


I am quite sure that I saw this on the mn88473 version of this hardware 
also. I just haven't had the time to test it. But I will postpone that 
until the tests on the other bridges are done.


MvH
Benjamin Larsson
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 0/3] [media] Fix race between graph enumeration and entities registration

2015-12-21 Thread Javier Martinez Canillas
Hello Mauro,

On 12/12/2015 10:50 AM, Mauro Carvalho Chehab wrote:
> Em Fri, 11 Dec 2015 19:57:06 -0300
> Javier Martinez Canillas  escreveu:
> 
>> Hello,
>>
>> This series fixes the issue of media device nodes being registered before
>> all the media entities and pads links are created so if user-space tries
>> to enumerate the graph too early, it may get a partial graph enumeration
>> since everything may not been registered yet.
>>
>> The solution (suggested by Sakari Ailus) is to separate the media device
>> registration from the initialization so drivers can first initialize the
>> media device, create the graph and then finally register the media device
>> node once is finished.
>>
>> This is the fifth version of the series and is a rebase on top of latest
>> MC next gen and the only important change is the addition of patch 3/3.
>>
>> Patch #1 adds a check to the media_device_unregister() function to know if
>> the media device has been registed yet so calling it will be safe and the
>> cleanup functions of the drivers won't need to be changed in case register
>> failed.
>>
>> Patch #2 does the init and registration split, changing all the drivers to
>> make the change atomic and also adds a cleanup function for media devices.
>>
>> Patch #3 sets a topology version 0 at media device registration to allow
>> user-space to know that the graph is "static" (i.e: no graph updates after
>> the media device was registered).
> 
> Got some troubles when compiling those patches:
> 
> drivers/media/usb/dvb-usb/dvb-usb-dvb.c: In function 
> ‘dvb_usb_media_device_init’:
> drivers/media/usb/dvb-usb/dvb-usb-dvb.c:104:6: warning: unused variable ‘ret’ 
> [-Wunused-variable]
>   int ret;
>   ^
> drivers/media/usb/dvb-usb/dvb-usb-dvb.c: In function 
> ‘dvb_usb_media_device_register’:
> drivers/media/usb/dvb-usb/dvb-usb-dvb.c:129:2: warning: ignoring return value 
> of ‘__media_device_register’, declared with attribute warn_unused_result 
> [-Wunused-result]
>   media_device_register(adap->dvb_adap.mdev);
>   ^
> 
> drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function 
> ‘dvb_usbv2_media_device_init’:
> drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:409:6: warning: unused variable 
> ‘ret’ [-Wunused-variable]
>   int ret;
>   ^
> drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function 
> ‘dvb_usbv2_adapter_frontend_init’:
> drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:706:34: warning: passing argument 
> 1 of ‘dvb_usbv2_media_device_register’ from incompatible pointer type 
> [-Wincompatible-pointer-types]
>   dvb_usbv2_media_device_register(>dvb_adap);
>   ^
> drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:432:13: note: expected ‘struct 
> dvb_usb_adapter *’ but argument is of type ‘struct dvb_adapter *’
>  static void dvb_usbv2_media_device_register(struct dvb_usb_adapter *adap)
>  ^
> drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function 
> ‘dvb_usbv2_media_device_register’:
> drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:435:2: warning: ignoring return 
> value of ‘__media_device_register’, declared with attribute 
> warn_unused_result [-Wunused-result]
>   media_device_register(adap->dvb_adap.mdev);
> 
>

Sorry for missing these, the patches needed a rebase but neither
omap2plus_defconfig nor exynos_defconfing (the platforms I used
for testing) enabled DVB_USB and I forgot to do a more extensive
build test.

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [media] rc: sunxi-cir: Initialize the spinlock properly

2015-12-21 Thread Chen-Yu Tsai
The driver allocates the spinlock but fails to initialize it correctly.
The kernel reports a BUG indicating bad spinlock magic when spinlock
debugging is enabled.

Call spin_lock_init() on it to initialize it correctly.

Fixes: b4e3e59fb59c ("[media] rc: add sunxi-ir driver")
Signed-off-by: Chen-Yu Tsai 
---
 drivers/media/rc/sunxi-cir.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c
index 7830aef3db45..40f77685cc4a 100644
--- a/drivers/media/rc/sunxi-cir.c
+++ b/drivers/media/rc/sunxi-cir.c
@@ -153,6 +153,8 @@ static int sunxi_ir_probe(struct platform_device *pdev)
if (!ir)
return -ENOMEM;
 
+   spin_lock_init(>ir_lock);
+
if (of_device_is_compatible(dn, "allwinner,sun5i-a13-ir"))
ir->fifo_size = 64;
else
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] au8522: Avoid memory leak in case of errors

2015-12-21 Thread Mauro Carvalho Chehab
As reported by kmemleak:

unreferenced object 0x880321e1da40 (size 32):
  comm "modprobe", pid 3309, jiffies 4295019569 (age 2359.636s)
  hex dump (first 32 bytes):
47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  G...
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
  backtrace:
[] kmemleak_alloc+0x4e/0xb0
[] kmem_cache_alloc_trace+0x1ec/0x280
[] au8522_probe+0x19a/0xa30 [au8522_decoder]
[] i2c_device_probe+0x2b2/0x490
[] driver_probe_device+0x454/0xd90
[] __device_attach_driver+0x17b/0x230
[] bus_for_each_drv+0x11a/0x1b0
[] __device_attach+0x1cd/0x2c0
[] device_initial_probe+0x13/0x20
[] bus_probe_device+0x1af/0x250
[] device_add+0x943/0x13b0
[] device_register+0x1a/0x20
[] i2c_new_device+0x5d6/0x8f0
[] v4l2_i2c_new_subdev_board+0x1e4/0x250 
[v4l2_common]
[] v4l2_i2c_new_subdev+0xd7/0x110 [v4l2_common]
[] au0828_card_analog_fe_setup+0x2e6/0x3f0 
[au0828]

Checking where the error happens:
(gdb) list *au8522_probe+0x19a
0x99a is in au8522_probe 
(drivers/media/dvb-frontends/au8522_decoder.c:761).
756 printk(KERN_INFO "au8522_decoder attach 
existing instance.\n");
757 break;
758 }
759
760 demod_config = kzalloc(sizeof(struct au8522_config), 
GFP_KERNEL);
761 if (demod_config == NULL) {
762 if (instance == 1)
763 kfree(state);
764 return -ENOMEM;
765 }

Shows that the error pathc is not being handled properly. The issue here is
that it should have been calling hybrid_tuner_release_state() function, by
calling au8522_release_state().

Yet, it is easier to just reorder the allocation, with makes the error path
simpler.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/dvb-frontends/au8522_decoder.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/media/dvb-frontends/au8522_decoder.c 
b/drivers/media/dvb-frontends/au8522_decoder.c
index 28d7dc2fee34..88fddbbf8491 100644
--- a/drivers/media/dvb-frontends/au8522_decoder.c
+++ b/drivers/media/dvb-frontends/au8522_decoder.c
@@ -738,11 +738,16 @@ static int au8522_probe(struct i2c_client *client,
return -EIO;
}
 
+   demod_config = kzalloc(sizeof(struct au8522_config), GFP_KERNEL);
+   if (!demod_config)
+   return -ENOMEM;
+
/* allocate memory for the internal state */
instance = au8522_get_state(, client->adapter, client->addr);
switch (instance) {
case 0:
printk(KERN_ERR "au8522_decoder allocation failed\n");
+   kfree(demod_config);
return -EIO;
case 1:
/* new demod instance */
@@ -754,12 +759,6 @@ static int au8522_probe(struct i2c_client *client,
break;
}
 
-   demod_config = kzalloc(sizeof(struct au8522_config), GFP_KERNEL);
-   if (demod_config == NULL) {
-   if (instance == 1)
-   kfree(state);
-   return -ENOMEM;
-   }
demod_config->demod_address = 0x8e >> 1;
 
state->config = demod_config;
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] [media] media-device: better lock media_device_unregister()

2015-12-21 Thread Javier Martinez Canillas
Hello Mauro,

On 12/15/2015 07:43 AM, Mauro Carvalho Chehab wrote:
> If media_device_unregister() is called by two different
> drivers, a race condition may happen, as the check if the
> device is not registered is not protected.
> 
> Move the spin_lock() to happen earlier in the function, in order
> to prevent such race condition.
> 
> Reported-by: Shuah Khan 
> Signed-off-by: Mauro Carvalho Chehab 
> ---

The patch looks good and I also tested it on an OMAP3 IGEPv2 board:

Reviewed-by: Javier Martinez Canillas 
Tested-by: Javier Martinez Canillas 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 1/3] [media] media-device: check before unregister if mdev was registered

2015-12-21 Thread Javier Martinez Canillas
Hello Mauro,

On 12/15/2015 07:41 AM, Mauro Carvalho Chehab wrote:
> Em Fri, 11 Dec 2015 16:36:27 -0700
> Shuah Khan  escreveu:
> 
>> On 12/11/2015 03:57 PM, Javier Martinez Canillas wrote:
>>> Most media functions that unregister, check if the corresponding register
>>> function succeed before. So these functions can safely be called even if a
>>> registration was never made or the component as already been unregistered.
>>>
>>> Add the same check to media_device_unregister() function for consistency.
>>>
>>> This will also allow to split the media_device_register() function in an
>>> initialization and registration functions without the need to change the
>>> generic cleanup functions and error code paths for all the media drivers.
>>>
>>> Suggested-by: Sakari Ailus 
>>> Signed-off-by: Javier Martinez Canillas 
>>> Acked-by: Sakari Ailus 
>>>
>>> ---
>>>
>>> Changes in v5: None
>>> Changes in v4: None
>>> Changes in v3: None
>>> Changes in v2:
>>> - Reword the documentation for media_device_unregister(). Suggested by 
>>> Sakari.
>>> - Added Sakari's Acked-by tag for patch #1.
>>>
>>>  drivers/media/media-device.c | 6 ++
>>>  1 file changed, 6 insertions(+)
>>>
>>> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
>>> index c12481c753a0..11c1c7383361 100644
>>> --- a/drivers/media/media-device.c
>>> +++ b/drivers/media/media-device.c
>>> @@ -577,6 +577,8 @@ EXPORT_SYMBOL_GPL(__media_device_register);
>>>   * media_device_unregister - unregister a media device
>>>   * @mdev:  The media device
>>>   *
>>> + * It is safe to call this function on an unregistered
>>> + * (but initialised) media device.
>>>   */
>>>  void media_device_unregister(struct media_device *mdev)
>>>  {
>>> @@ -584,6 +586,10 @@ void media_device_unregister(struct media_device *mdev)
>>> struct media_entity *next;
>>> struct media_interface *intf, *tmp_intf;
>>>  
>>> +   /* Check if mdev was ever registered at all */
>>> +   if (!media_devnode_is_registered(>devnode))
>>> +   return;
>>
>> This is a good check, however, this check will not prevent
>> media_device_unregister() from getting run twice by two
>> different drivers. i.e media_devnode gets unregistered
>> towards the end of at the end of media_device_unregister().
>>
>> In an example case, if bridge driver and snd-usb-aduio both
>> call media_device_unregister(), this check won't help prevent
>> media_device_unregister() being done only once. I think we
>> need a different state variable in struct media_device
>> to ensure unregister is done only once.
> 
> True. We need move the spin_lock() code to be called before
> calling media_device_is_registered().
> 

I see, the check in $SUBJECT was to avoid each driver to have a similar
check for cleanup in its error path but I didn't take into account the
fact that two drivers may share the same struct media_device, as you
explained to me is the case for ALSA and V4L2 MC integration.

> I'm sending such patches.
>

Thanks, I'll review and test them.
 
> Thanks for reporting it.
> 
> Regards,
> Mauro
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] [media] media-device: move media entity register/unregister functions

2015-12-21 Thread Javier Martinez Canillas
Hello Mauro,

On 12/15/2015 07:43 AM, Mauro Carvalho Chehab wrote:
> media entity register and unregister functions are called by media
> device register/unregister. Move them to occur earlier, as we'll need
> an unlocked version of media_device_entity_unregister() and we don't
> want to add a function prototype without needing it.
> 
> No functional changes.
> 
> Signed-off-by: Mauro Carvalho Chehab 

Patch looks good to me.

Reviewed-by: Javier Martinez Canillas 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [v4l-utils PATCH 1/1] Allow building static binaries

2015-12-21 Thread Sakari Ailus
Hi Gregor,

On Wed, Dec 16, 2015 at 09:21:16PM +0100, Gregor Jasny wrote:
> Hello,
> 
> On 10/12/15 14:21, Sakari Ailus wrote:
> > I discussed with Hans and he thought you'd be the best person to take a look
> > at this.
> > 
> > The case is that I'd like to build static binaries and that doesn't seem to
> > work with what's in Makefile.am for libv4l1 and libv4l2 at the moment.
> 
> Sorry for the late reply. Didi not notice this email earlier. Your patch
> does not do what you'd like to achieve. Both v4l1compat and v4l2convert
> are libraries which only purpose is to get preloaded by the loader. So
> build them statically does not make sense. Instead they should not be
> built at all. To achieve this the WITH_V4L_WRAPPERS variable should
> evaluate to false. This is triggered by
> 
> AM_CONDITIONAL([WITH_V4L_WRAPPERS], [test x$enable_libv4l != xno -a
> x$enable_shared != xno])
> 
> So changing
> 
> LDFLAGS="--static -static" ./configure --enable-static
> 
> to
> 
> LDFLAGS="--static -static" ./configure --enable-static --disabled-shared
> 
> should do the trick. Does this help?

It does. I get statically linked binaries now without changes. Thank you,
Gregor!

Hans, Mauro, please ignore the patch.

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] [media] au8522: Avoid memory leak for device config data

2015-12-21 Thread Mauro Carvalho Chehab
As reported by kmemleak:

unreferenced object 0x880321e1da40 (size 32):
  comm "modprobe", pid 3309, jiffies 4295019569 (age 2359.636s)
  hex dump (first 32 bytes):
47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  G...
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
  backtrace:
[] kmemleak_alloc+0x4e/0xb0
[] kmem_cache_alloc_trace+0x1ec/0x280
[] au8522_probe+0x19a/0xa30 [au8522_decoder]
[] i2c_device_probe+0x2b2/0x490
[] driver_probe_device+0x454/0xd90
[] __device_attach_driver+0x17b/0x230
[] bus_for_each_drv+0x11a/0x1b0
[] __device_attach+0x1cd/0x2c0
[] device_initial_probe+0x13/0x20
[] bus_probe_device+0x1af/0x250
[] device_add+0x943/0x13b0
[] device_register+0x1a/0x20
[] i2c_new_device+0x5d6/0x8f0
[] v4l2_i2c_new_subdev_board+0x1e4/0x250 
[v4l2_common]
[] v4l2_i2c_new_subdev+0xd7/0x110 [v4l2_common]
[] au0828_card_analog_fe_setup+0x2e6/0x3f0 
[au0828]

Checking where the error happens:
(gdb) list *au8522_probe+0x19a
0x99a is in au8522_probe 
(drivers/media/dvb-frontends/au8522_decoder.c:761).
756 printk(KERN_INFO "au8522_decoder attach 
existing instance.\n");
757 break;
758 }
759
760 demod_config = kzalloc(sizeof(struct au8522_config), 
GFP_KERNEL);
761 if (demod_config == NULL) {
762 if (instance == 1)
763 kfree(state);
764 return -ENOMEM;
765 }

Shows that the error path is not being handled properly.

The are actually several issues here:

1) config free should have been calling hybrid_tuner_release_state()
function, by calling au8522_release_state();

2) config is only allocated at the digital part. On the analog one,
it is received from the caller.

A complex logic could be added to address it, however, it is simpler
to just embeed config inside the state.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/dvb-frontends/au8522_common.c  | 10 +-
 drivers/media/dvb-frontends/au8522_decoder.c | 10 +-
 drivers/media/dvb-frontends/au8522_dig.c | 16 
 drivers/media/dvb-frontends/au8522_priv.h|  2 +-
 4 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/drivers/media/dvb-frontends/au8522_common.c 
b/drivers/media/dvb-frontends/au8522_common.c
index 3559ff230045..f135126bc373 100644
--- a/drivers/media/dvb-frontends/au8522_common.c
+++ b/drivers/media/dvb-frontends/au8522_common.c
@@ -44,7 +44,7 @@ int au8522_writereg(struct au8522_state *state, u16 reg, u8 
data)
int ret;
u8 buf[] = { (reg >> 8) | 0x80, reg & 0xff, data };
 
-   struct i2c_msg msg = { .addr = state->config->demod_address,
+   struct i2c_msg msg = { .addr = state->config.demod_address,
   .flags = 0, .buf = buf, .len = 3 };
 
ret = i2c_transfer(state->i2c, , 1);
@@ -64,9 +64,9 @@ u8 au8522_readreg(struct au8522_state *state, u16 reg)
u8 b1[] = { 0 };
 
struct i2c_msg msg[] = {
-   { .addr = state->config->demod_address, .flags = 0,
+   { .addr = state->config.demod_address, .flags = 0,
  .buf = b0, .len = 2 },
-   { .addr = state->config->demod_address, .flags = I2C_M_RD,
+   { .addr = state->config.demod_address, .flags = I2C_M_RD,
  .buf = b1, .len = 1 } };
 
ret = i2c_transfer(state->i2c, msg, 2);
@@ -140,7 +140,7 @@ EXPORT_SYMBOL(au8522_release_state);
 
 static int au8522_led_gpio_enable(struct au8522_state *state, int onoff)
 {
-   struct au8522_led_config *led_config = state->config->led_cfg;
+   struct au8522_led_config *led_config = state->config.led_cfg;
u8 val;
 
/* bail out if we can't control an LED */
@@ -170,7 +170,7 @@ static int au8522_led_gpio_enable(struct au8522_state 
*state, int onoff)
  */
 int au8522_led_ctrl(struct au8522_state *state, int led)
 {
-   struct au8522_led_config *led_config = state->config->led_cfg;
+   struct au8522_led_config *led_config = state->config.led_cfg;
int i, ret = 0;
 
/* bail out if we can't control an LED */
diff --git a/drivers/media/dvb-frontends/au8522_decoder.c 
b/drivers/media/dvb-frontends/au8522_decoder.c
index 28d7dc2fee34..b3502a6191ba 100644
--- a/drivers/media/dvb-frontends/au8522_decoder.c
+++ b/drivers/media/dvb-frontends/au8522_decoder.c
@@ -754,15 +754,7 @@ static int au8522_probe(struct i2c_client *client,
break;
}
 
-   demod_config = kzalloc(sizeof(struct au8522_config), GFP_KERNEL);
-   if (demod_config == NULL) {
- 

[PATCH] [media] cx231xx: fix compilation when !CONFIG_MEDIA_CONTROLLER

2015-12-21 Thread Javier Martinez Canillas
Commit 1590ad7b5271 ("[media] media-device: split media initialization
and registration") split the media dev initialization and registration
but introduced a build error since media_device_register() was called
unconditionally even when the MEDIA_CONTROLLER config was not enabled:

   drivers/media/usb/cx231xx/cx231xx-cards.c: In function 'cx231xx_usb_probe':
   drivers/media/usb/cx231xx/cx231xx-cards.c:1741:36: error: 'struct cx231xx' 
has no member named 'media_dev'
 retval = media_device_register(dev->media_dev);

Fixes: 1590ad7b5271 ("[media] media-device: split media initialization and 
registration")
Reported-by: Fengguang Wu 
Signed-off-by: Javier Martinez Canillas 

---

 drivers/media/usb/cx231xx/cx231xx-cards.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c 
b/drivers/media/usb/cx231xx/cx231xx-cards.c
index 35692d19b652..220a5dba8a2d 100644
--- a/drivers/media/usb/cx231xx/cx231xx-cards.c
+++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
@@ -1751,7 +1751,9 @@ static int cx231xx_usb_probe(struct usb_interface 
*interface,
if (retval < 0)
goto done;
 
+#ifdef CONFIG_MEDIA_CONTROLLER
retval = media_device_register(dev->media_dev);
+#endif
 
 done:
if (retval < 0)
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [media] ir-lirc-codec.c: don't leak lirc->drv-rbuf

2015-12-21 Thread Mauro Carvalho Chehab
As reported by kmemleak:

unreferenced object 0x8802adae0ba0 (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:
[] kmemleak_alloc+0x4e/0xb0
[] kmem_cache_alloc_trace+0x1ec/0x280
[] ir_lirc_register+0x8d/0x7a0 [ir_lirc_codec]
[] ir_raw_event_register+0x318/0x4b0 [rc_core]
[] rc_register_device+0xf2d/0x1450 [rc_core]
[] au0828_rc_register+0x7d1/0xa10 [au0828]
[] au0828_usb_probe+0x6c2/0xcf0 [au0828]
[] usb_probe_interface+0x45d/0x940
[] driver_probe_device+0x454/0xd90
[] __driver_attach+0x121/0x160
[] bus_for_each_dev+0x11f/0x1a0
[] driver_attach+0x3d/0x50
[] bus_add_driver+0x4c9/0x770
[] driver_register+0x18c/0x3b0
[] usb_register_driver+0x1f8/0x440
[] 0xa13680b7

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: Mauro Carvalho Chehab 
---
 drivers/media/rc/ir-lirc-codec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c
index a32659fcd266..5effc65d2947 100644
--- a/drivers/media/rc/ir-lirc-codec.c
+++ b/drivers/media/rc/ir-lirc-codec.c
@@ -415,6 +415,7 @@ static int ir_lirc_unregister(struct rc_dev *dev)
 
lirc_unregister_driver(lirc->drv->minor);
lirc_buffer_free(lirc->drv->rbuf);
+   kfree(lirc->drv->rbuf);
kfree(lirc->drv);
 
return 0;
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usbtv: discard redundant video fields

2015-12-21 Thread Lubomir Rintel
On Sun, 2015-12-20 at 12:57 +0100, Nikola Forró wrote:
> There are many dropped fields with some sources, leading to many
> redundant fields without counterparts. When this redundant field
> is odd, a new frame is pushed containing this odd field interleaved
> with whatever was left in the buffer, causing video artifacts.
> 
> Do not push a new frame after processing every odd field, but do it
> only after those which come after an even field.
> 
> Signed-off-by: Nikola Forró 

Acked-by: Lubomir Rintel 

Thanks,
Lubo
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] [media] au8522: Avoid memory leak for device config data

2015-12-21 Thread kbuild test robot
Hi Mauro,

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.4-rc6 next-20151221]

url:
https://github.com/0day-ci/linux/commits/Mauro-Carvalho-Chehab/au8522-Avoid-memory-leak-for-device-config-data/20151222-010649
base:   git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-x000-201551 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   drivers/media/dvb-frontends/au8522_decoder.c: In function 'au8522_probe':
>> drivers/media/dvb-frontends/au8522_decoder.c:779:3: warning: 'demod_config' 
>> may be used uninitialized in this function [-Wmaybe-uninitialized]
  kfree(demod_config);
  ^

vim +/demod_config +779 drivers/media/dvb-frontends/au8522_decoder.c

5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  763 hdl = >hdl;
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  764 v4l2_ctrl_handler_init(hdl, 4);
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  765 v4l2_ctrl_new_std(hdl, _ctrl_ops,
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  766 V4L2_CID_BRIGHTNESS, 0, 255, 1, 109);
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  767 v4l2_ctrl_new_std(hdl, _ctrl_ops,
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  768 V4L2_CID_CONTRAST, 0, 255, 1,
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  769 AU8522_TVDEC_CONTRAST_REG00BH_CVBS);
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  770 v4l2_ctrl_new_std(hdl, _ctrl_ops,
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  771 V4L2_CID_SATURATION, 0, 255, 1, 128);
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  772 v4l2_ctrl_new_std(hdl, _ctrl_ops,
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  773 V4L2_CID_HUE, -32768, 32767, 1, 0);
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  774 sd->ctrl_handler = hdl;
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  775 if (hdl->error) {
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  776 int err = hdl->error;
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  777  
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  778 v4l2_ctrl_handler_free(hdl);
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15 @779 kfree(demod_config);
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  780 kfree(state);
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  781 return err;
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  782 }
5a4bdb4b drivers/media/dvb-frontends/au8522_decoder.c Hans Verkuil  
2013-02-15  783  
968cf782 drivers/media/dvb/frontends/au8522_decoder.c Devin Heitmueller 
2009-03-11  784 state->c = client;
f2fd7ce6 drivers/media/dvb-frontends/au8522_decoder.c Mauro Carvalho Chehab 
2014-06-08  785 state->std = V4L2_STD_NTSC_M;
968cf782 drivers/media/dvb/frontends/au8522_decoder.c Devin Heitmueller 
2009-03-11  786 state->vid_input = AU8522_COMPOSITE_CH1;
968cf782 drivers/media/dvb/frontends/au8522_decoder.c Devin Heitmueller 
2009-03-11  787 state->aud_input = AU8522_AUDIO_NONE;

:: The code at line 779 was first introduced by commit
:: 5a4bdb4b34b90655891f627679bbba0ed9791c2e [media] au8522_decoder: convert 
to the control framework

:: TO: Hans Verkuil <hans.verk...@cisco.com>
:: CC: Mauro Carvalho Chehab <mche...@redhat.com>

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data