[patch 2/2] drivers/media/video/cx23885/cx23885-core.c: fix cx23885_dev_checkrevision()

2010-10-01 Thread akpm
From: Andrew Morton a...@linux-foundation.org

It was missing the `break'.

Addresses https://bugzilla.kernel.org/show_bug.cgi?id=18672

Reported-by: Igor i2g...@gmail.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/cx23885/cx23885-core.c |1 +
 1 file changed, 1 insertion(+)

diff -puN 
drivers/media/video/cx23885/cx23885-core.c~drivers-media-video-cx23885-cx23885-corec-fix-cx23885_dev_checkrevision
 drivers/media/video/cx23885/cx23885-core.c
--- 
a/drivers/media/video/cx23885/cx23885-core.c~drivers-media-video-cx23885-cx23885-corec-fix-cx23885_dev_checkrevision
+++ a/drivers/media/video/cx23885/cx23885-core.c
@@ -815,6 +815,7 @@ static void cx23885_dev_checkrevision(st
case 0x0e:
/* CX23887-15Z */
dev-hwrevision = 0xc0;
+   break;
case 0x0f:
/* CX23887-14Z */
dev-hwrevision = 0xb1;
_
--
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 1/2] drivers/media/IR/ene_ir.c: fix NULL dereference

2010-10-01 Thread akpm
From: Jiri Slaby jsl...@suse.cz

When 'dev' allocation fails in ene_probe we jump to error label where we
dereference the 'dev'.  Fix it by jumping few lines below.

Signed-off-by: Jiri Slaby jsl...@suse.cz
Cc: Maxim Levitsky maximlevit...@gmail.com
Cc: Mauro Carvalho Chehab mche...@redhat.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/IR/ene_ir.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -puN 
drivers/media/IR/ene_ir.c~drivers-media-ir-ene_irc-fix-null-dereference 
drivers/media/IR/ene_ir.c
--- a/drivers/media/IR/ene_ir.c~drivers-media-ir-ene_irc-fix-null-dereference
+++ a/drivers/media/IR/ene_ir.c
@@ -785,7 +785,7 @@ static int ene_probe(struct pnp_dev *pnp
dev = kzalloc(sizeof(struct ene_device), GFP_KERNEL);
 
if (!input_dev || !ir_props || !dev)
-   goto error;
+   goto error1;
 
/* validate resources */
error = -ENODEV;
@@ -899,7 +899,7 @@ error:
free_irq(dev-irq, dev);
if (dev-hw_io)
release_region(dev-hw_io, ENE_MAX_IO);
-
+error1:
input_free_device(input_dev);
kfree(ir_props);
kfree(dev);
_
--
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 1/2] dib3000mc: reduce large stack usage fix

2010-07-20 Thread akpm
From: Andrew Morton a...@linux-foundation.org

s/ENODEV/ENOMEM, per Andreas.

This fix got lost when someone merged dib3000mc: reduce large stack
usage.  Please don't lose fixes.

Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Patrick Boettcher pboettc...@dibcom.fr
Cc: Randy Dunlap randy.dun...@oracle.com
Cc: Andreas Oberritter o...@linuxtv.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/dvb/frontends/dib3000mc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/media/dvb/frontends/dib3000mc.c~dib3000mc-reduce-large-stack-usage-fix 
drivers/media/dvb/frontends/dib3000mc.c
--- 
a/drivers/media/dvb/frontends/dib3000mc.c~dib3000mc-reduce-large-stack-usage-fix
+++ a/drivers/media/dvb/frontends/dib3000mc.c
@@ -822,7 +822,7 @@ int dib3000mc_i2c_enumeration(struct i2c
 
dmcst = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL);
if (dmcst == NULL)
-   return -ENODEV;
+   return -ENOMEM;
 
dmcst-i2c_adap = i2c;
 
_
--
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 2/2] drivers/video/omap2/displays: add missing mutex_unlock

2010-07-20 Thread akpm
From: Julia Lawall ju...@diku.dk

Add a mutex_unlock missing on the error paths.  The use of the mutex is
balanced elsewhere in the file.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// smpl
@@
expression E1;
@@

* mutex_lock(E1,...);
  +... when != E1
  if (...) {
... when != E1
*   return ...;
  }
  ...+
* mutex_unlock(E1,...);
// /smpl

Signed-off-by: Julia Lawall ju...@diku.dk
Acked-By: Mike Isely is...@pobox.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/video/omap2/displays/panel-acx565akm.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -puN 
drivers/video/omap2/displays/panel-acx565akm.c~drivers-video-omap2-displays-add-missing-mutex_unlock
 drivers/video/omap2/displays/panel-acx565akm.c
--- 
a/drivers/video/omap2/displays/panel-acx565akm.c~drivers-video-omap2-displays-add-missing-mutex_unlock
+++ a/drivers/video/omap2/displays/panel-acx565akm.c
@@ -592,7 +592,7 @@ static int acx_panel_power_on(struct oma
r = omapdss_sdi_display_enable(dssdev);
if (r) {
pr_err(%s sdi enable failed\n, __func__);
-   return r;
+   goto fail_unlock;
}
 
/*FIXME tweak me */
@@ -633,6 +633,8 @@ static int acx_panel_power_on(struct oma
return acx565akm_bl_update_status(md-bl_dev);
 fail:
omapdss_sdi_display_disable(dssdev);
+fail_unlock:
+   mutex_unlock(md-mutex);
return r;
 }
 
_
--
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 02/11] dib7000p: reduce large stack usage

2010-04-27 Thread akpm
From: Randy Dunlap randy.dun...@oracle.com

Reduce the static stack usage of one of the 2 top offenders as listed by
'make checkstack':

Building with CONFIG_FRAME_WARN=2048 produces:

drivers/media/dvb/frontends/dib7000p.c:1367: warning: the frame size of 2320 
bytes is larger than 2048 bytes

and in 'make checkstack', the stack usage goes from:
0x2409 dib7000p_i2c_enumeration [dib7000p]: 2328
to unlisted with this patch.

Also change one caller of dib7000p_i2c_enumeration() to check its
return value.

Signed-off-by: Randy Dunlap randy.dun...@oracle.com
Cc: Patrick Boettcher pboettc...@dibcom.fr
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/dvb/dvb-usb/cxusb.c  |5 +--
 drivers/media/dvb/frontends/dib7000p.c |   36 ++-
 2 files changed, 25 insertions(+), 16 deletions(-)

diff -puN drivers/media/dvb/dvb-usb/cxusb.c~dib7000p-reduce-large-stack-usage 
drivers/media/dvb/dvb-usb/cxusb.c
--- a/drivers/media/dvb/dvb-usb/cxusb.c~dib7000p-reduce-large-stack-usage
+++ a/drivers/media/dvb/dvb-usb/cxusb.c
@@ -1025,8 +1025,9 @@ static int cxusb_dualdig4_rev2_frontend_
 
cxusb_bluebird_gpio_pulse(adap-dev, 0x02, 1);
 
-   dib7000p_i2c_enumeration(adap-dev-i2c_adap, 1, 18,
-cxusb_dualdig4_rev2_config);
+   if (dib7000p_i2c_enumeration(adap-dev-i2c_adap, 1, 18,
+cxusb_dualdig4_rev2_config)  0)
+   return -ENODEV;
 
adap-fe = dvb_attach(dib7000p_attach, adap-dev-i2c_adap, 0x80,
  cxusb_dualdig4_rev2_config);
diff -puN 
drivers/media/dvb/frontends/dib7000p.c~dib7000p-reduce-large-stack-usage 
drivers/media/dvb/frontends/dib7000p.c
--- a/drivers/media/dvb/frontends/dib7000p.c~dib7000p-reduce-large-stack-usage
+++ a/drivers/media/dvb/frontends/dib7000p.c
@@ -1324,46 +1324,54 @@ EXPORT_SYMBOL(dib7000p_pid_filter);
 
 int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 
default_addr, struct dib7000p_config cfg[])
 {
-   struct dib7000p_state st = { .i2c_adap = i2c };
+   struct dib7000p_state *dpst;
int k = 0;
u8 new_addr = 0;
 
+   dpst = kzalloc(sizeof(struct dib7000p_state), GFP_KERNEL);
+   if (!dpst)
+   return -ENODEV;
+
+   dpst-i2c_adap = i2c;
+
for (k = no_of_demods-1; k = 0; k--) {
-   st.cfg = cfg[k];
+   dpst-cfg = cfg[k];
 
/* designated i2c address */
new_addr  = (0x40 + k)  1;
-   st.i2c_addr = new_addr;
-   dib7000p_write_word(st, 1287, 0x0003); /* sram lead in, rdy */
-   if (dib7000p_identify(st) != 0) {
-   st.i2c_addr = default_addr;
-   dib7000p_write_word(st, 1287, 0x0003); /* sram lead 
in, rdy */
-   if (dib7000p_identify(st) != 0) {
+   dpst-i2c_addr = new_addr;
+   dib7000p_write_word(dpst, 1287, 0x0003); /* sram lead in, rdy */
+   if (dib7000p_identify(dpst) != 0) {
+   dpst-i2c_addr = default_addr;
+   dib7000p_write_word(dpst, 1287, 0x0003); /* sram lead 
in, rdy */
+   if (dib7000p_identify(dpst) != 0) {
dprintk(DiB7000P #%d: not identified\n, k);
+   kfree(dpst);
return -EIO;
}
}
 
/* start diversity to pull_down div_str - just for 
i2c-enumeration */
-   dib7000p_set_output_mode(st, OUTMODE_DIVERSITY);
+   dib7000p_set_output_mode(dpst, OUTMODE_DIVERSITY);
 
/* set new i2c address and force divstart */
-   dib7000p_write_word(st, 1285, (new_addr  2) | 0x2);
+   dib7000p_write_word(dpst, 1285, (new_addr  2) | 0x2);
 
dprintk(IC %d initialized (to i2c_address 0x%x), k, new_addr);
}
 
for (k = 0; k  no_of_demods; k++) {
-   st.cfg = cfg[k];
-   st.i2c_addr = (0x40 + k)  1;
+   dpst-cfg = cfg[k];
+   dpst-i2c_addr = (0x40 + k)  1;
 
// unforce divstr
-   dib7000p_write_word(st, 1285, st.i2c_addr  2);
+   dib7000p_write_word(dpst, 1285, dpst-i2c_addr  2);
 
/* deactivate div - it was just for i2c-enumeration */
-   dib7000p_set_output_mode(st, OUTMODE_HIGH_Z);
+   dib7000p_set_output_mode(dpst, OUTMODE_HIGH_Z);
}
 
+   kfree(dpst);
return 0;
 }
 EXPORT_SYMBOL(dib7000p_i2c_enumeration);
_
--
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 01/11] dib3000mc: reduce large stack usage

2010-04-27 Thread akpm
From: Randy Dunlap randy.dun...@oracle.com

Reduce the static stack usage of one of the 2 top offenders as listed by
'make checkstack':

Building with CONFIG_FRAME_WARN=2048 produces:

drivers/media/dvb/frontends/dib3000mc.c:853: warning: the frame size of 2224 
bytes is larger than 2048 bytes

and in 'make checkstack', the stack usage goes from:
0x0bbd dib3000mc_i2c_enumeration [dib3000mc]:   2232
to unlisted with this patch.

Signed-off-by: Randy Dunlap randy.dun...@oracle.com
Cc: Patrick Boettcher pboettc...@dibcom.fr
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/dvb/frontends/dib3000mc.c |   35 +-
 1 file changed, 22 insertions(+), 13 deletions(-)

diff -puN 
drivers/media/dvb/frontends/dib3000mc.c~dib3000mc-reduce-large-stack-usage 
drivers/media/dvb/frontends/dib3000mc.c
--- a/drivers/media/dvb/frontends/dib3000mc.c~dib3000mc-reduce-large-stack-usage
+++ a/drivers/media/dvb/frontends/dib3000mc.c
@@ -814,42 +814,51 @@ EXPORT_SYMBOL(dib3000mc_set_config);
 
 int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 
default_addr, struct dib3000mc_config cfg[])
 {
-   struct dib3000mc_state st = { .i2c_adap = i2c };
+   struct dib3000mc_state *dmcst;
int k;
u8 new_addr;
 
static u8 DIB3000MC_I2C_ADDRESS[] = {20,22,24,26};
 
+   dmcst = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL);
+   if (dmcst == NULL)
+   return -ENODEV;
+
+   dmcst-i2c_adap = i2c;
+
for (k = no_of_demods-1; k = 0; k--) {
-   st.cfg = cfg[k];
+   dmcst-cfg = cfg[k];
 
/* designated i2c address */
new_addr  = DIB3000MC_I2C_ADDRESS[k];
-   st.i2c_addr = new_addr;
-   if (dib3000mc_identify(st) != 0) {
-   st.i2c_addr = default_addr;
-   if (dib3000mc_identify(st) != 0) {
+   dmcst-i2c_addr = new_addr;
+   if (dib3000mc_identify(dmcst) != 0) {
+   dmcst-i2c_addr = default_addr;
+   if (dib3000mc_identify(dmcst) != 0) {
dprintk(-E-  DiB3000P/MC #%d: not 
identified\n, k);
+   kfree(dmcst);
return -ENODEV;
}
}
 
-   dib3000mc_set_output_mode(st, OUTMODE_MPEG2_PAR_CONT_CLK);
+   dib3000mc_set_output_mode(dmcst, OUTMODE_MPEG2_PAR_CONT_CLK);
 
// set new i2c address and force divstr (Bit 1) to value 0 (Bit 
0)
-   dib3000mc_write_word(st, 1024, (new_addr  3) | 0x1);
-   st.i2c_addr = new_addr;
+   dib3000mc_write_word(dmcst, 1024, (new_addr  3) | 0x1);
+   dmcst-i2c_addr = new_addr;
}
 
for (k = 0; k  no_of_demods; k++) {
-   st.cfg = cfg[k];
-   st.i2c_addr = DIB3000MC_I2C_ADDRESS[k];
+   dmcst-cfg = cfg[k];
+   dmcst-i2c_addr = DIB3000MC_I2C_ADDRESS[k];
 
-   dib3000mc_write_word(st, 1024, st.i2c_addr  3);
+   dib3000mc_write_word(dmcst, 1024, dmcst-i2c_addr  3);
 
/* turn off data output */
-   dib3000mc_set_output_mode(st, OUTMODE_HIGH_Z);
+   dib3000mc_set_output_mode(dmcst, OUTMODE_HIGH_Z);
}
+
+   kfree(dmcst);
return 0;
 }
 EXPORT_SYMBOL(dib3000mc_i2c_enumeration);
_
--
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 10/11] ir-keytable: avoid double lock

2010-04-27 Thread akpm
From: Dan Carpenter erro...@gmail.com

It's possible that we wanted to resize to a smaller size but we didn't
have enough memory to create the new table.  We need to test for that here
so we don't try to lock twice and dead lock.  Also we free the oldkeymap
on that path and that would be bad.

Signed-off-by: Dan Carpenter erro...@gmail.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Dmitry Torokhov d...@mail.ru
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/IR/ir-keytable.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/media/IR/ir-keytable.c~ir-keytable-avoid-double-lock 
drivers/media/IR/ir-keytable.c
--- a/drivers/media/IR/ir-keytable.c~ir-keytable-avoid-double-lock
+++ a/drivers/media/IR/ir-keytable.c
@@ -217,7 +217,7 @@ static void ir_delete_key(struct ir_scan
memcpy(newkeymap[elem], oldkeymap[elem + 1],
   (newsize - elem) * sizeof(*newkeymap));
 
-   if (resize) {
+   if (resize  newkeymap != oldkeymap) {
/*
 * As the copy happened to a temporary table, only here
 * it needs to lock while replacing the table pointers
_
--
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 05/11] drivers/media/video/au0828/au0828-video.c: off by one bug

2010-04-27 Thread akpm
From: Dan Carpenter erro...@gmail.com

The AUVI_INPUT(tmp) macro uses tmp as an index of an array with
AU0828_MAX_INPUT elements.

Signed-off-by: Dan Carpenter erro...@gmail.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/au0828/au0828-video.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/media/video/au0828/au0828-video.c~drivers-media-video-au0828-au0828-videoc-off-by-one-bug
 drivers/media/video/au0828/au0828-video.c
--- 
a/drivers/media/video/au0828/au0828-video.c~drivers-media-video-au0828-au0828-videoc-off-by-one-bug
+++ a/drivers/media/video/au0828/au0828-video.c
@@ -1105,7 +1105,7 @@ static int vidioc_enum_input(struct file
 
tmp = input-index;
 
-   if (tmp  AU0828_MAX_INPUT)
+   if (tmp = AU0828_MAX_INPUT)
return -EINVAL;
if (AUVI_INPUT(tmp).type == 0)
return -EINVAL;
_
--
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 09/11] cx88: improve error handling

2010-04-27 Thread akpm
From: Dan Carpenter erro...@gmail.com

Return -EINVAL if we don't find the right query control id.

Signed-off-by: Dan Carpenter erro...@gmail.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Hans Verkuil hverk...@xs4all.nl
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/cx88/cx88-video.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff -puN drivers/media/video/cx88/cx88-video.c~cx88-improve-error-handling 
drivers/media/video/cx88/cx88-video.c
--- a/drivers/media/video/cx88/cx88-video.c~cx88-improve-error-handling
+++ a/drivers/media/video/cx88/cx88-video.c
@@ -1537,9 +1537,12 @@ static int radio_queryctrl (struct file 
c-id = V4L2_CID_LASTP1)
return -EINVAL;
if (c-id == V4L2_CID_AUDIO_MUTE) {
-   for (i = 0; i  CX8800_CTLS; i++)
+   for (i = 0; i  CX8800_CTLS; i++) {
if (cx8800_ctls[i].v.id == c-id)
break;
+   }
+   if (i == CX8800_CTLS)
+   return -EINVAL;
*c = cx8800_ctls[i].v;
} else
*c = no_ctl;
_
--
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 07/11] drivers/media/video/et61x251/et61x251_core.c: improve error handling

2010-04-27 Thread akpm
From: Dan Carpenter erro...@gmail.com

The original code doesn't handle the situation where the controller is not
found.

Signed-off-by: Dan Carpenter erro...@gmail.com
Cc: Luca Risolia luca.riso...@studio.unibo.it
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/et61x251/et61x251_core.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff -puN 
drivers/media/video/et61x251/et61x251_core.c~drivers-media-video-et61x251-et61x251_corec-improve-error-handling
 drivers/media/video/et61x251/et61x251_core.c
--- 
a/drivers/media/video/et61x251/et61x251_core.c~drivers-media-video-et61x251-et61x251_corec-improve-error-handling
+++ a/drivers/media/video/et61x251/et61x251_core.c
@@ -1713,7 +1713,7 @@ et61x251_vidioc_s_ctrl(struct et61x251_d
if (copy_from_user(ctrl, arg, sizeof(ctrl)))
return -EFAULT;
 
-   for (i = 0; i  ARRAY_SIZE(s-qctrl); i++)
+   for (i = 0; i  ARRAY_SIZE(s-qctrl); i++) {
if (ctrl.id == s-qctrl[i].id) {
if (s-qctrl[i].flags  V4L2_CTRL_FLAG_DISABLED)
return -EINVAL;
@@ -1723,7 +1723,9 @@ et61x251_vidioc_s_ctrl(struct et61x251_d
ctrl.value -= ctrl.value % s-qctrl[i].step;
break;
}
-
+   }
+   if (i == ARRAY_SIZE(s-qctrl))
+   return -EINVAL;
if ((err = s-set_ctrl(cam, ctrl)))
return err;
 
_
--
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 11/11] cx231xx: improve error handling

2010-04-27 Thread akpm
From: Dan Carpenter erro...@gmail.com

Return -EINVAL if we don't find the control id.

Signed-off-by: Dan Carpenter erro...@gmail.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Trent Piepho xy...@speakeasy.org
Cc: Douglas Schilling Landgraf dougsl...@redhat.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/cx231xx/cx231xx-video.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff -puN 
drivers/media/video/cx231xx/cx231xx-video.c~cx231xx-improve-error-handling 
drivers/media/video/cx231xx/cx231xx-video.c
--- a/drivers/media/video/cx231xx/cx231xx-video.c~cx231xx-improve-error-handling
+++ a/drivers/media/video/cx231xx/cx231xx-video.c
@@ -1902,9 +1902,12 @@ static int radio_queryctrl(struct file *
if (c-id  V4L2_CID_BASE || c-id = V4L2_CID_LASTP1)
return -EINVAL;
if (c-id == V4L2_CID_AUDIO_MUTE) {
-   for (i = 0; i  CX231XX_CTLS; i++)
+   for (i = 0; i  CX231XX_CTLS; i++) {
if (cx231xx_ctls[i].v.id == c-id)
break;
+   }
+   if (i == CX231XX_CTLS)
+   return -EINVAL;
*c = cx231xx_ctls[i].v;
} else
*c = no_ctl;
_
--
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 2/5] drivers/media/video: move dereference after NULL test

2010-03-11 Thread akpm
From: Julia Lawall ju...@diku.dk

In quickcam_messenger.c, if the NULL test on uvd is needed, then the
dereference should be after the NULL test.

In vpif_display.c, std_info is initialized to the address of a structure
field.  This seems unlikely to be NULL.  If it could somehow be NULL, then
the assignment should be moved after the NULL test.  Alternatively, perhaps
the NULL test is intended to test std_info-stdid rather than std_info?

In saa7134-alsa.c, the function is only called from one place, where the
chip argument has already been dereferenced.  On the other hand, if it
should be kept, then card should be initialized after it.

A simplified version of the semantic match that detects this problem is as
follows (http://coccinelle.lip6.fr/):

// smpl
@match exists@
expression x, E;
identifier fld;
@@

* x-fld
  ... when != \(x = E\|x\)
* x == NULL
// /smpl

Signed-off-by: Julia Lawall ju...@diku.dk
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/davinci/vpif_display.c|2 --
 drivers/media/video/saa7134/saa7134-alsa.c|2 --
 drivers/media/video/usbvideo/quickcam_messenger.c |3 ++-
 3 files changed, 2 insertions(+), 5 deletions(-)

diff -puN 
drivers/media/video/davinci/vpif_display.c~drivers-media-video-move-dereference-after-null-test
 drivers/media/video/davinci/vpif_display.c
--- 
a/drivers/media/video/davinci/vpif_display.c~drivers-media-video-move-dereference-after-null-test
+++ a/drivers/media/video/davinci/vpif_display.c
@@ -383,8 +383,6 @@ static int vpif_get_std_info(struct chan
int index;
 
std_info-stdid = vid_ch-stdid;
-   if (!std_info)
-   return -1;
 
for (index = 0; index  ARRAY_SIZE(ch_params); index++) {
config = ch_params[index];
diff -puN 
drivers/media/video/saa7134/saa7134-alsa.c~drivers-media-video-move-dereference-after-null-test
 drivers/media/video/saa7134/saa7134-alsa.c
--- 
a/drivers/media/video/saa7134/saa7134-alsa.c~drivers-media-video-move-dereference-after-null-test
+++ a/drivers/media/video/saa7134/saa7134-alsa.c
@@ -1011,8 +1011,6 @@ static int snd_card_saa7134_new_mixer(sn
unsigned int idx;
int err, addr;
 
-   if (snd_BUG_ON(!chip))
-   return -EINVAL;
strcpy(card-mixername, SAA7134 Mixer);
 
for (idx = 0; idx  ARRAY_SIZE(snd_saa7134_volume_controls); idx++) {
diff -puN 
drivers/media/video/usbvideo/quickcam_messenger.c~drivers-media-video-move-dereference-after-null-test
 drivers/media/video/usbvideo/quickcam_messenger.c
--- 
a/drivers/media/video/usbvideo/quickcam_messenger.c~drivers-media-video-move-dereference-after-null-test
+++ a/drivers/media/video/usbvideo/quickcam_messenger.c
@@ -692,12 +692,13 @@ static int qcm_start_data(struct uvd *uv
 
 static void qcm_stop_data(struct uvd *uvd)
 {
-   struct qcm *cam = (struct qcm *) uvd-user_data;
+   struct qcm *cam;
int i, j;
int ret;
 
if ((uvd == NULL) || (!uvd-streaming) || (uvd-dev == NULL))
return;
+   cam = (struct qcm *) uvd-user_data;
 
ret = qcm_camera_off(uvd);
if (ret)
_
--
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 3/5] v4l/dvb: gspca - sn9c20x: correct onstack wait_queue_head declaration

2010-03-11 Thread akpm
From: Yong Zhang yong.zha...@gmail.com

Use DECLARE_WAIT_QUEUE_HEAD_ONSTACK to make lockdep happy.

Signed-off-by: Yong Zhang yong.zha...@gmail.com
Cc: Brian Johnson brij...@gmail.com
Cc: Jean-Francois Moine moin...@free.fr
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/gspca/sn9c20x.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/media/video/gspca/sn9c20x.c~v4l-dvb-gspca-sn9c20x-correct-onstack-wait_queue_head-declaration
 drivers/media/video/gspca/sn9c20x.c
--- 
a/drivers/media/video/gspca/sn9c20x.c~v4l-dvb-gspca-sn9c20x-correct-onstack-wait_queue_head-declaration
+++ a/drivers/media/video/gspca/sn9c20x.c
@@ -1426,7 +1426,7 @@ static int input_kthread(void *data)
struct gspca_dev *gspca_dev = (struct gspca_dev *)data;
struct sd *sd = (struct sd *) gspca_dev;
 
-   DECLARE_WAIT_QUEUE_HEAD(wait);
+   DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wait);
set_freezable();
for (;;) {
if (kthread_should_stop())
_
--
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 1/5] drivers/media/video/cx23885 needs kfifo conversion

2010-03-11 Thread akpm
From: Andrew Morton a...@linux-foundation.org

linux-next:

drivers/media/video/cx23885/cx23888-ir.c: In function 'cx23888_ir_irq_handler':
drivers/media/video/cx23885/cx23888-ir.c:597: error: implicit declaration of 
function 'kfifo_put'
drivers/media/video/cx23885/cx23888-ir.c: In function 'cx23888_ir_rx_read':
drivers/media/video/cx23885/cx23888-ir.c:660: error: implicit declaration of 
function 'kfifo_get'
drivers/media/video/cx23885/cx23888-ir.c: In function 'cx23888_ir_probe':
drivers/media/video/cx23885/cx23888-ir.c:1172: warning: passing argument 1 of 
'kfifo_alloc' makes pointer from integer without a cast
drivers/media/video/cx23885/cx23888-ir.c:1172: warning: passing argument 3 of 
'kfifo_alloc' makes integer from pointer without a cast
drivers/media/video/cx23885/cx23888-ir.c:1172: warning: assignment makes 
pointer from integer without a cast
drivers/media/video/cx23885/cx23888-ir.c:1178: warning: passing argument 1 of 
'kfifo_alloc' makes pointer from integer without a cast
drivers/media/video/cx23885/cx23888-ir.c:1178: warning: passing argument 3 of 
'kfifo_alloc' makes integer from pointer without a cast
drivers/media/video/cx23885/cx23888-ir.c:1178: warning: assignment makes 
pointer from integer without a cast

Cc: Stefani Seibold stef...@seibold.net
DESC
drivers/media/video/cx23885: needs kfifo updates
EDESC
From: Andrew Morton a...@linux-foundation.org

linux-next again.

Cc: Stefani Seibold stef...@seibold.net
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/cx231xx/Kconfig |1 +
 drivers/media/video/cx23885/Kconfig |1 +
 2 files changed, 2 insertions(+)

diff -puN 
drivers/media/video/cx231xx/Kconfig~drivers-media-video-cx23885-needs-kfifo-conversion
 drivers/media/video/cx231xx/Kconfig
--- 
a/drivers/media/video/cx231xx/Kconfig~drivers-media-video-cx23885-needs-kfifo-conversion
+++ a/drivers/media/video/cx231xx/Kconfig
@@ -1,6 +1,7 @@
 config VIDEO_CX231XX
tristate Conexant cx231xx USB video capture support
depends on VIDEO_DEV  I2C  INPUT
+   depends on BROKEN
select VIDEO_TUNER
select VIDEO_TVEEPROM
select VIDEO_IR
diff -puN 
drivers/media/video/cx23885/Kconfig~drivers-media-video-cx23885-needs-kfifo-conversion
 drivers/media/video/cx23885/Kconfig
--- 
a/drivers/media/video/cx23885/Kconfig~drivers-media-video-cx23885-needs-kfifo-conversion
+++ a/drivers/media/video/cx23885/Kconfig
@@ -1,6 +1,7 @@
 config VIDEO_CX23885
tristate Conexant cx23885 (2388x successor) support
depends on DVB_CORE  VIDEO_DEV  PCI  I2C  INPUT
+   depends on BROKEN
select I2C_ALGOBIT
select VIDEO_BTCX
select VIDEO_TUNER
_
--
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 5/5] dib7000p: reduce large stack usage

2010-03-11 Thread akpm
From: Randy Dunlap randy.dun...@oracle.com

Reduce the static stack usage of one of the 2 top offenders as listed by
'make checkstack':

Building with CONFIG_FRAME_WARN=2048 produces:

drivers/media/dvb/frontends/dib7000p.c:1367: warning: the frame size of 2320 
bytes is larger than 2048 bytes

and in 'make checkstack', the stack usage goes from:
0x2409 dib7000p_i2c_enumeration [dib7000p]: 2328
to unlisted with this patch.

Also change one caller of dib7000p_i2c_enumeration() to check its
return value.

Signed-off-by: Randy Dunlap randy.dun...@oracle.com
Cc: Patrick Boettcher pboettc...@dibcom.fr
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/dvb/dvb-usb/cxusb.c  |5 +--
 drivers/media/dvb/frontends/dib7000p.c |   36 ++-
 2 files changed, 25 insertions(+), 16 deletions(-)

diff -puN drivers/media/dvb/dvb-usb/cxusb.c~dib7000p-reduce-large-stack-usage 
drivers/media/dvb/dvb-usb/cxusb.c
--- a/drivers/media/dvb/dvb-usb/cxusb.c~dib7000p-reduce-large-stack-usage
+++ a/drivers/media/dvb/dvb-usb/cxusb.c
@@ -1024,8 +1024,9 @@ static int cxusb_dualdig4_rev2_frontend_
 
cxusb_bluebird_gpio_pulse(adap-dev, 0x02, 1);
 
-   dib7000p_i2c_enumeration(adap-dev-i2c_adap, 1, 18,
-cxusb_dualdig4_rev2_config);
+   if (dib7000p_i2c_enumeration(adap-dev-i2c_adap, 1, 18,
+cxusb_dualdig4_rev2_config)  0)
+   return -ENODEV;
 
adap-fe = dvb_attach(dib7000p_attach, adap-dev-i2c_adap, 0x80,
  cxusb_dualdig4_rev2_config);
diff -puN 
drivers/media/dvb/frontends/dib7000p.c~dib7000p-reduce-large-stack-usage 
drivers/media/dvb/frontends/dib7000p.c
--- a/drivers/media/dvb/frontends/dib7000p.c~dib7000p-reduce-large-stack-usage
+++ a/drivers/media/dvb/frontends/dib7000p.c
@@ -1323,46 +1323,54 @@ EXPORT_SYMBOL(dib7000p_pid_filter);
 
 int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 
default_addr, struct dib7000p_config cfg[])
 {
-   struct dib7000p_state st = { .i2c_adap = i2c };
+   struct dib7000p_state *dpst;
int k = 0;
u8 new_addr = 0;
 
+   dpst = kzalloc(sizeof(struct dib7000p_state), GFP_KERNEL);
+   if (!dpst)
+   return -ENODEV;
+
+   dpst-i2c_adap = i2c;
+
for (k = no_of_demods-1; k = 0; k--) {
-   st.cfg = cfg[k];
+   dpst-cfg = cfg[k];
 
/* designated i2c address */
new_addr  = (0x40 + k)  1;
-   st.i2c_addr = new_addr;
-   dib7000p_write_word(st, 1287, 0x0003); /* sram lead in, rdy */
-   if (dib7000p_identify(st) != 0) {
-   st.i2c_addr = default_addr;
-   dib7000p_write_word(st, 1287, 0x0003); /* sram lead 
in, rdy */
-   if (dib7000p_identify(st) != 0) {
+   dpst-i2c_addr = new_addr;
+   dib7000p_write_word(dpst, 1287, 0x0003); /* sram lead in, rdy */
+   if (dib7000p_identify(dpst) != 0) {
+   dpst-i2c_addr = default_addr;
+   dib7000p_write_word(dpst, 1287, 0x0003); /* sram lead 
in, rdy */
+   if (dib7000p_identify(dpst) != 0) {
dprintk(DiB7000P #%d: not identified\n, k);
+   kfree(dpst);
return -EIO;
}
}
 
/* start diversity to pull_down div_str - just for 
i2c-enumeration */
-   dib7000p_set_output_mode(st, OUTMODE_DIVERSITY);
+   dib7000p_set_output_mode(dpst, OUTMODE_DIVERSITY);
 
/* set new i2c address and force divstart */
-   dib7000p_write_word(st, 1285, (new_addr  2) | 0x2);
+   dib7000p_write_word(dpst, 1285, (new_addr  2) | 0x2);
 
dprintk(IC %d initialized (to i2c_address 0x%x), k, new_addr);
}
 
for (k = 0; k  no_of_demods; k++) {
-   st.cfg = cfg[k];
-   st.i2c_addr = (0x40 + k)  1;
+   dpst-cfg = cfg[k];
+   dpst-i2c_addr = (0x40 + k)  1;
 
// unforce divstr
-   dib7000p_write_word(st, 1285, st.i2c_addr  2);
+   dib7000p_write_word(dpst, 1285, dpst-i2c_addr  2);
 
/* deactivate div - it was just for i2c-enumeration */
-   dib7000p_set_output_mode(st, OUTMODE_HIGH_Z);
+   dib7000p_set_output_mode(dpst, OUTMODE_HIGH_Z);
}
 
+   kfree(dpst);
return 0;
 }
 EXPORT_SYMBOL(dib7000p_i2c_enumeration);
_
--
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 4/5] dib3000mc: reduce large stack usage

2010-03-11 Thread akpm
From: Randy Dunlap randy.dun...@oracle.com

Reduce the static stack usage of one of the 2 top offenders as listed by
'make checkstack':

Building with CONFIG_FRAME_WARN=2048 produces:

drivers/media/dvb/frontends/dib3000mc.c:853: warning: the frame size of 2224 
bytes is larger than 2048 bytes

and in 'make checkstack', the stack usage goes from:
0x0bbd dib3000mc_i2c_enumeration [dib3000mc]:   2232
to unlisted with this patch.

Signed-off-by: Randy Dunlap randy.dun...@oracle.com
Cc: Patrick Boettcher pboettc...@dibcom.fr
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/dvb/frontends/dib3000mc.c |   35 +-
 1 file changed, 22 insertions(+), 13 deletions(-)

diff -puN 
drivers/media/dvb/frontends/dib3000mc.c~dib3000mc-reduce-large-stack-usage 
drivers/media/dvb/frontends/dib3000mc.c
--- a/drivers/media/dvb/frontends/dib3000mc.c~dib3000mc-reduce-large-stack-usage
+++ a/drivers/media/dvb/frontends/dib3000mc.c
@@ -813,42 +813,51 @@ EXPORT_SYMBOL(dib3000mc_set_config);
 
 int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 
default_addr, struct dib3000mc_config cfg[])
 {
-   struct dib3000mc_state st = { .i2c_adap = i2c };
+   struct dib3000mc_state *dmcst;
int k;
u8 new_addr;
 
static u8 DIB3000MC_I2C_ADDRESS[] = {20,22,24,26};
 
+   dmcst = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL);
+   if (dmcst == NULL)
+   return -ENODEV;
+
+   dmcst-i2c_adap = i2c;
+
for (k = no_of_demods-1; k = 0; k--) {
-   st.cfg = cfg[k];
+   dmcst-cfg = cfg[k];
 
/* designated i2c address */
new_addr  = DIB3000MC_I2C_ADDRESS[k];
-   st.i2c_addr = new_addr;
-   if (dib3000mc_identify(st) != 0) {
-   st.i2c_addr = default_addr;
-   if (dib3000mc_identify(st) != 0) {
+   dmcst-i2c_addr = new_addr;
+   if (dib3000mc_identify(dmcst) != 0) {
+   dmcst-i2c_addr = default_addr;
+   if (dib3000mc_identify(dmcst) != 0) {
dprintk(-E-  DiB3000P/MC #%d: not 
identified\n, k);
+   kfree(dmcst);
return -ENODEV;
}
}
 
-   dib3000mc_set_output_mode(st, OUTMODE_MPEG2_PAR_CONT_CLK);
+   dib3000mc_set_output_mode(dmcst, OUTMODE_MPEG2_PAR_CONT_CLK);
 
// set new i2c address and force divstr (Bit 1) to value 0 (Bit 
0)
-   dib3000mc_write_word(st, 1024, (new_addr  3) | 0x1);
-   st.i2c_addr = new_addr;
+   dib3000mc_write_word(dmcst, 1024, (new_addr  3) | 0x1);
+   dmcst-i2c_addr = new_addr;
}
 
for (k = 0; k  no_of_demods; k++) {
-   st.cfg = cfg[k];
-   st.i2c_addr = DIB3000MC_I2C_ADDRESS[k];
+   dmcst-cfg = cfg[k];
+   dmcst-i2c_addr = DIB3000MC_I2C_ADDRESS[k];
 
-   dib3000mc_write_word(st, 1024, st.i2c_addr  3);
+   dib3000mc_write_word(dmcst, 1024, dmcst-i2c_addr  3);
 
/* turn off data output */
-   dib3000mc_set_output_mode(st, OUTMODE_HIGH_Z);
+   dib3000mc_set_output_mode(dmcst, OUTMODE_HIGH_Z);
}
+
+   kfree(dmcst);
return 0;
 }
 EXPORT_SYMBOL(dib3000mc_i2c_enumeration);
_
--
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 3/7] drivers/media/video/Kconfig: add VIDEO_DEV dependency as needed in drivers/media/video/Kconfig

2010-02-02 Thread akpm
From: Mike Pagano mpag...@gentoo.org

Add VIDEO_DEV as dependency of VIDEO_CAPTURE_DRIVERS and all of the
devices listed under this setting.

Signed-off-by: Mike Pagano mpag...@gentoo.org
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/Kconfig |   20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff -puN 
drivers/media/video/Kconfig~drivers-media-video-kconfig-add-video_dev-dependency-as-needed-in-drivers-media-video-kconfig
 drivers/media/video/Kconfig
--- 
a/drivers/media/video/Kconfig~drivers-media-video-kconfig-add-video_dev-dependency-as-needed-in-drivers-media-video-kconfig
+++ a/drivers/media/video/Kconfig
@@ -51,14 +51,14 @@ config VIDEO_TUNER
 
 menuconfig VIDEO_CAPTURE_DRIVERS
bool Video capture adapters
-   depends on VIDEO_V4L2
+   depends on VIDEO_V4L2  VIDEO_DEV
default y
---help---
  Say Y here to enable selecting the video adapters for
  webcams, analog TV, and hybrid analog/digital TV.
  Some of those devices also supports FM radio.
 
-if VIDEO_CAPTURE_DRIVERS  VIDEO_V4L2
+if VIDEO_DEV  VIDEO_CAPTURE_DRIVERS  VIDEO_V4L2
 
 config VIDEO_ADV_DEBUG
bool Enable advanced debug functionality
@@ -500,7 +500,7 @@ endmenu # encoder / decoder chips
 
 config DISPLAY_DAVINCI_DM646X_EVM
tristate DM646x EVM Video Display
-   depends on VIDEO_DEV  MACH_DAVINCI_DM6467_EVM
+   depends on MACH_DAVINCI_DM6467_EVM
select VIDEOBUF_DMA_CONTIG
select VIDEO_DAVINCI_VPIF
select VIDEO_ADV7343
@@ -513,7 +513,7 @@ config DISPLAY_DAVINCI_DM646X_EVM
 
 config CAPTURE_DAVINCI_DM646X_EVM
tristate DM646x EVM Video Capture
-   depends on VIDEO_DEV  MACH_DAVINCI_DM6467_EVM
+   depends on MACH_DAVINCI_DM6467_EVM
select VIDEOBUF_DMA_CONTIG
select VIDEO_DAVINCI_VPIF
help
@@ -533,7 +533,7 @@ config VIDEO_DAVINCI_VPIF
 
 config VIDEO_VIVI
tristate Virtual Video Driver
-   depends on VIDEO_DEV  VIDEO_V4L2  !SPARC32  !SPARC64
+   depends on VIDEO_V4L2  !SPARC32  !SPARC64
select VIDEOBUF_VMALLOC
default n
---help---
@@ -889,7 +889,7 @@ config MX1_VIDEO
 
 config VIDEO_MX1
tristate i.MX1/i.MXL CMOS Sensor Interface driver
-   depends on VIDEO_DEV  ARCH_MX1  SOC_CAMERA
+   depends on ARCH_MX1  SOC_CAMERA
select FIQ
select VIDEOBUF_DMA_CONTIG
select MX1_VIDEO
@@ -901,7 +901,7 @@ config MX3_VIDEO
 
 config VIDEO_MX3
tristate i.MX3x Camera Sensor Interface driver
-   depends on VIDEO_DEV  MX3_IPU  SOC_CAMERA
+   depends on MX3_IPU  SOC_CAMERA
select VIDEOBUF_DMA_CONTIG
select MX3_VIDEO
---help---
@@ -909,21 +909,21 @@ config VIDEO_MX3
 
 config VIDEO_PXA27x
tristate PXA27x Quick Capture Interface driver
-   depends on VIDEO_DEV  PXA27x  SOC_CAMERA
+   depends on PXA27x  SOC_CAMERA
select VIDEOBUF_DMA_SG
---help---
  This is a v4l2 driver for the PXA27x Quick Capture Interface
 
 config VIDEO_SH_MOBILE_CEU
tristate SuperH Mobile CEU Interface driver
-   depends on VIDEO_DEV  SOC_CAMERA  HAS_DMA  HAVE_CLK
+   depends on SOC_CAMERA  HAS_DMA  HAVE_CLK
select VIDEOBUF_DMA_CONTIG
---help---
  This is a v4l2 driver for the SuperH Mobile CEU Interface
 
 config VIDEO_OMAP2
tristate OMAP2 Camera Capture Interface driver
-   depends on VIDEO_DEV  ARCH_OMAP2
+   depends on ARCH_OMAP2
select VIDEOBUF_DMA_SG
---help---
  This is a v4l2 driver for the TI OMAP2 camera capture interface
_
--
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 2/7] drivers/media/video/pms.c needs version.h

2010-02-02 Thread akpm
From: Andrew Morton a...@linux-foundation.org

i386 allmodconfig:

drivers/media/video/pms.c: In function 'pms_querycap':
drivers/media/video/pms.c:682: error: implicit declaration of function 
'KERNEL_VERSION'

Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/pms.c |1 +
 1 file changed, 1 insertion(+)

diff -puN drivers/media/video/pms.c~drivers-media-video-pmsc-needs-versionh 
drivers/media/video/pms.c
--- a/drivers/media/video/pms.c~drivers-media-video-pmsc-needs-versionh
+++ a/drivers/media/video/pms.c
@@ -24,6 +24,7 @@
 #include linux/delay.h
 #include linux/errno.h
 #include linux/fs.h
+#include linux/version.h
 #include linux/kernel.h
 #include linux/slab.h
 #include linux/mm.h
_
--
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 5/7] drivers/media/video/cx18/cx18-alsa-pcm.c: fix printk warning

2010-02-02 Thread akpm
From: Andrew Morton a...@linux-foundation.org

drivers/media/video/cx18/cx18-alsa-pcm.c: In function 
'cx18_alsa_announce_pcm_data':
drivers/media/video/cx18/cx18-alsa-pcm.c:82: warning: format '%d' expects type 
'int', but argument 5 has type 'size_t'

Cc: Andy Walls awa...@radix.net
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/cx18/cx18-alsa-pcm.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/media/video/cx18/cx18-alsa-pcm.c~drivers-media-video-cx18-cx18-alsa-pcmc-fix-printk-warning
 drivers/media/video/cx18/cx18-alsa-pcm.c
--- 
a/drivers/media/video/cx18/cx18-alsa-pcm.c~drivers-media-video-cx18-cx18-alsa-pcmc-fix-printk-warning
+++ a/drivers/media/video/cx18/cx18-alsa-pcm.c
@@ -79,7 +79,7 @@ void cx18_alsa_announce_pcm_data(struct 
int period_elapsed = 0;
int length;
 
-   dprintk(cx18 alsa announce ptr=%p data=%p num_bytes=%d\n, cxsc,
+   dprintk(cx18 alsa announce ptr=%p data=%p num_bytes=%zd\n, cxsc,
pcm_data, num_bytes);
 
substream = cxsc-capture_pcm_substream;
_
--
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 4/7] radio: add support for SAA7706H Car Radio DSP

2010-02-02 Thread akpm
From: Richard Röjfors richard.rojf...@pelagicore.com

Initial support for the SAA7706H Car Radio DSP.

It is a I2C device and currently the mute control is supported.

When the device is unmuted it is brought out of reset and initiated using
the proposed intialisation sequence.

When muted the DSP is brought into reset state.

[a...@linux-foundation.org: include delay.h]
Signed-off-by: Richard Röjfors richard.rojf...@pelagicore.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Douglas Schilling Landgraf dougsl...@gmail.com
Cc: Hans Verkuil hverk...@xs4all.nl
Cc: Randy Dunlap randy.dun...@oracle.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/radio/Kconfig |   12 
 drivers/media/radio/Makefile|1 
 drivers/media/radio/saa7706h.c  |  451 ++
 include/media/v4l2-chip-ident.h |3 
 4 files changed, 467 insertions(+)

diff -puN 
drivers/media/radio/Kconfig~radio-add-the-saa7706h-car-radio-dsp-to-v4l2-chip-identh
 drivers/media/radio/Kconfig
--- 
a/drivers/media/radio/Kconfig~radio-add-the-saa7706h-car-radio-dsp-to-v4l2-chip-identh
+++ a/drivers/media/radio/Kconfig
@@ -417,6 +417,18 @@ config RADIO_TEA5764_XTAL
  Say Y here if TEA5764 have a 32768 Hz crystal in circuit, say N
  here if TEA5764 reference frequency is connected in FREQIN.
 
+config RADIO_SAA7706H
+   tristate SAA7706H Car Radio DSP
+   depends on I2C  VIDEO_V4L2
+   ---help---
+ Say Y here if you want to use the SAA7706H Car radio Digital
+ Signal Processor, found for instance on the Russellville development
+ board. On the russellville the device is connected to internal
+ timberdale I2C bus.
+
+ To compile this driver as a module, choose M here: the
+ module will be called SAA7706H.
+
 config RADIO_TEF6862
tristate TEF6862 Car Radio Enhanced Selectivity Tuner
depends on I2C  VIDEO_V4L2
diff -puN 
drivers/media/radio/Makefile~radio-add-the-saa7706h-car-radio-dsp-to-v4l2-chip-identh
 drivers/media/radio/Makefile
--- 
a/drivers/media/radio/Makefile~radio-add-the-saa7706h-car-radio-dsp-to-v4l2-chip-identh
+++ a/drivers/media/radio/Makefile
@@ -23,6 +23,7 @@ obj-$(CONFIG_USB_DSBR) += dsbr100.o
 obj-$(CONFIG_RADIO_SI470X) += si470x/
 obj-$(CONFIG_USB_MR800) += radio-mr800.o
 obj-$(CONFIG_RADIO_TEA5764) += radio-tea5764.o
+obj-$(CONFIG_RADIO_SAA7706H) += saa7706h.o
 obj-$(CONFIG_RADIO_TEF6862) += tef6862.o
 
 EXTRA_CFLAGS += -Isound
diff -puN /dev/null drivers/media/radio/saa7706h.c
--- /dev/null
+++ a/drivers/media/radio/saa7706h.c
@@ -0,0 +1,451 @@
+/*
+ * saa7706.c Philips SAA7706H Car Radio DSP driver
+ * Copyright (c) 2009 Intel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include linux/module.h
+#include linux/init.h
+#include linux/delay.h
+#include linux/errno.h
+#include linux/kernel.h
+#include linux/interrupt.h
+#include linux/i2c.h
+#include media/v4l2-device.h
+#include media/v4l2-chip-ident.h
+
+#define DRIVER_NAME saa7706h
+
+/* the I2C memory map looks like this
+
+   $1C00 - $ Not Used
+   $2200 - $3FFF Reserved YRAM (DSP2) space
+   $2000 - $21FF YRAM (DSP2)
+   $1FF0 - $1FFF Hardware Registers
+   $1280 - $1FEF Reserved XRAM (DSP2) space
+   $1000 - $127F XRAM (DSP2)
+   $0FFFDSP CONTROL
+   $0A00 - $0FFE Reserved
+   $0980 - $09FF Reserved YRAM (DSP1) space
+   $0800 - $097F YRAM (DSP1)
+   $0200 - $07FF Not Used
+   $0180 - $01FF Reserved XRAM (DSP1) space
+   $ - $017F XRAM (DSP1)
+*/
+
+#define SAA7706H_REG_CTRL  0x0fff
+#define SAA7706H_CTRL_BYP_PLL  0x0001
+#define SAA7706H_CTRL_PLL_DIV_MASK 0x003e
+#define SAA7706H_CTRL_PLL3_62975MHZ0x003e
+#define SAA7706H_CTRL_DSP_TURBO0x0040
+#define SAA7706H_CTRL_PC_RESET_DSP10x0080
+#define SAA7706H_CTRL_PC_RESET_DSP20x0100
+#define SAA7706H_CTRL_DSP1_ROM_EN_MASK 0x0600
+#define SAA7706H_CTRL_DSP1_FUNC_PROM   0x
+#define SAA7706H_CTRL_DSP2_ROM_EN_MASK 0x1800
+#define SAA7706H_CTRL_DSP2_FUNC_PROM   0x
+#define SAA7706H_CTRL_DIG_SIL_INTERPOL 0x8000
+
+#define SAA7706H_REG_EVALUATION0x1ff0
+#define SAA7706H_EVAL_DISABLE_CHARGE_PUMP  0x01
+#define SAA7706H_EVAL_DCS_CLOCK0x02
+#define SAA7706H_EVAL_GNDRC1_ENABLE

[patch 7/7] drivers/media/dvb/frontends/stv090x.c: fix use-uninitlalised

2010-02-02 Thread akpm
From: Andrew Morton a...@linux-foundation.org

Mad guess.

Cc: Manu Abraham m...@linuxtv.org
Cc: Mauro Carvalho Chehab mche...@redhat.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/dvb/frontends/stv090x.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/media/dvb/frontends/stv090x.c~drivers-media-dvb-frontends-stv090xc-fix-use-uninitlalised
 drivers/media/dvb/frontends/stv090x.c
--- 
a/drivers/media/dvb/frontends/stv090x.c~drivers-media-dvb-frontends-stv090xc-fix-use-uninitlalised
+++ a/drivers/media/dvb/frontends/stv090x.c
@@ -2047,7 +2047,7 @@ static int stv090x_chk_tmg(struct stv090
u32 reg;
s32 tmg_cpt = 0, i;
u8 freq, tmg_thh, tmg_thl;
-   int tmg_lock;
+   int tmg_lock = 0;
 
freq = STV090x_READ_DEMOD(state, CARFREQ);
tmg_thh = STV090x_READ_DEMOD(state, TMGTHRISE);
_
--
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 2/3] proc_fops: convert av7110

2009-12-21 Thread akpm
From: Alexey Dobriyan adobri...@gmail.com

Drop S_IRUGO, proc entry doesn't contain read hooks.
Drop S_IFREG, simply unnecessary.

Signed-off-by: Alexey Dobriyan adobri...@gmail.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/dvb/ttpci/av7110_ir.c |   14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff -puN drivers/media/dvb/ttpci/av7110_ir.c~proc_fops-convert-av7110 
drivers/media/dvb/ttpci/av7110_ir.c
--- a/drivers/media/dvb/ttpci/av7110_ir.c~proc_fops-convert-av7110
+++ a/drivers/media/dvb/ttpci/av7110_ir.c
@@ -268,8 +268,8 @@ int av7110_check_ir_config(struct av7110
 
 
 /* /proc/av7110_ir interface */
-static int av7110_ir_write_proc(struct file *file, const char __user *buffer,
-   unsigned long count, void *data)
+static ssize_t av7110_ir_proc_write(struct file *file, const char __user 
*buffer,
+   size_t count, loff_t *pos)
 {
char *page;
u32 ir_config;
@@ -309,6 +309,10 @@ static int av7110_ir_write_proc(struct f
return count;
 }
 
+static const struct file_operations av7110_ir_proc_fops = {
+   .owner  = THIS_MODULE,
+   .write  = av7110_ir_proc_write,
+};
 
 /* interrupt handler */
 static void ir_handler(struct av7110 *av7110, u32 ircom)
@@ -368,11 +372,9 @@ int __devinit av7110_ir_init(struct av71
input_dev-timer.data = (unsigned long) av7110-ir;
 
if (av_cnt == 1) {
-   e = create_proc_entry(av7110_ir, S_IFREG | S_IRUGO | S_IWUSR, 
NULL);
-   if (e) {
-   e-write_proc = av7110_ir_write_proc;
+   e = proc_create(av7110_ir, S_IWUSR, NULL, 
av7110_ir_proc_fops);
+   if (e)
e-size = 4 + 256 * sizeof(u16);
-   }
}
 
tasklet_init(av7110-ir.ir_tasklet, av7110_emit_key, (unsigned long) 
av7110-ir);
_
--
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 3/3] drivers/media/video/pms.c needs version.h

2009-12-21 Thread akpm
From: Andrew Morton a...@linux-foundation.org

i386 allmodconfig:

drivers/media/video/pms.c: In function 'pms_querycap':
drivers/media/video/pms.c:682: error: implicit declaration of function 
'KERNEL_VERSION'

Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/pms.c |1 +
 1 file changed, 1 insertion(+)

diff -puN drivers/media/video/pms.c~drivers-media-video-pmsc-needs-versionh 
drivers/media/video/pms.c
--- a/drivers/media/video/pms.c~drivers-media-video-pmsc-needs-versionh
+++ a/drivers/media/video/pms.c
@@ -24,6 +24,7 @@
 #include linux/delay.h
 #include linux/errno.h
 #include linux/fs.h
+#include linux/version.h
 #include linux/kernel.h
 #include linux/slab.h
 #include linux/mm.h
_
--
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 1/3] drivers/media/video: Move dereference after NULL test

2009-12-21 Thread akpm
From: Julia Lawall ju...@diku.dk

In quickcam_messenger.c, if the NULL test on uvd is needed, then the
dereference should be after the NULL test.

In vpif_display.c, std_info is initialized to the address of a structure
field.  This seems unlikely to be NULL.  If it could somehow be NULL, then
the assignment should be moved after the NULL test.  Alternatively, perhaps
the NULL test is intended to test std_info-stdid rather than std_info?

In saa7134-alsa.c, the function is only called from one place, where the
chip argument has already been dereferenced.  On the other hand, if it
should be kept, then card should be initialized after it.

A simplified version of the semantic match that detects this problem is as
follows (http://coccinelle.lip6.fr/):

// smpl
@match exists@
expression x, E;
identifier fld;
@@

* x-fld
  ... when != \(x = E\|x\)
* x == NULL
// /smpl

Signed-off-by: Julia Lawall ju...@diku.dk
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/davinci/vpif_display.c|2 --
 drivers/media/video/saa7134/saa7134-alsa.c|2 --
 drivers/media/video/usbvideo/quickcam_messenger.c |3 ++-
 3 files changed, 2 insertions(+), 5 deletions(-)

diff -puN 
drivers/media/video/davinci/vpif_display.c~drivers-media-video-move-dereference-after-null-test
 drivers/media/video/davinci/vpif_display.c
--- 
a/drivers/media/video/davinci/vpif_display.c~drivers-media-video-move-dereference-after-null-test
+++ a/drivers/media/video/davinci/vpif_display.c
@@ -383,8 +383,6 @@ static int vpif_get_std_info(struct chan
int index;
 
std_info-stdid = vid_ch-stdid;
-   if (!std_info)
-   return -1;
 
for (index = 0; index  ARRAY_SIZE(ch_params); index++) {
config = ch_params[index];
diff -puN 
drivers/media/video/saa7134/saa7134-alsa.c~drivers-media-video-move-dereference-after-null-test
 drivers/media/video/saa7134/saa7134-alsa.c
--- 
a/drivers/media/video/saa7134/saa7134-alsa.c~drivers-media-video-move-dereference-after-null-test
+++ a/drivers/media/video/saa7134/saa7134-alsa.c
@@ -1011,8 +1011,6 @@ static int snd_card_saa7134_new_mixer(sn
unsigned int idx;
int err, addr;
 
-   if (snd_BUG_ON(!chip))
-   return -EINVAL;
strcpy(card-mixername, SAA7134 Mixer);
 
for (idx = 0; idx  ARRAY_SIZE(snd_saa7134_volume_controls); idx++) {
diff -puN 
drivers/media/video/usbvideo/quickcam_messenger.c~drivers-media-video-move-dereference-after-null-test
 drivers/media/video/usbvideo/quickcam_messenger.c
--- 
a/drivers/media/video/usbvideo/quickcam_messenger.c~drivers-media-video-move-dereference-after-null-test
+++ a/drivers/media/video/usbvideo/quickcam_messenger.c
@@ -692,12 +692,13 @@ static int qcm_start_data(struct uvd *uv
 
 static void qcm_stop_data(struct uvd *uvd)
 {
-   struct qcm *cam = (struct qcm *) uvd-user_data;
+   struct qcm *cam;
int i, j;
int ret;
 
if ((uvd == NULL) || (!uvd-streaming) || (uvd-dev == NULL))
return;
+   cam = (struct qcm *) uvd-user_data;
 
ret = qcm_camera_off(uvd);
if (ret)
_
--
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 5/5] dvb: make struct videobuf_queue_ops constant

2009-11-17 Thread akpm
From: Jonathan Corbet cor...@lwn.net

The videobuf_queue_ops function vector is not declared constant, but
there's no need for the videobuf layer to ever change it.  Make it const
so that videobuf users can make their operations const without warnings.

Signed-off-by: Jonathan Corbet cor...@lwn.net
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/videobuf-core.c   |2 +-
 drivers/media/video/videobuf-dma-contig.c |2 +-
 drivers/media/video/videobuf-dma-sg.c |2 +-
 drivers/media/video/videobuf-vmalloc.c|2 +-
 include/media/videobuf-core.h |4 ++--
 include/media/videobuf-dma-contig.h   |2 +-
 include/media/videobuf-dma-sg.h   |2 +-
 include/media/videobuf-vmalloc.h  |2 +-
 8 files changed, 9 insertions(+), 9 deletions(-)

diff -puN 
drivers/media/video/videobuf-core.c~dvb-make-struct-videobuf_queue_ops-constant 
drivers/media/video/videobuf-core.c
--- 
a/drivers/media/video/videobuf-core.c~dvb-make-struct-videobuf_queue_ops-constant
+++ a/drivers/media/video/videobuf-core.c
@@ -110,7 +110,7 @@ EXPORT_SYMBOL_GPL(videobuf_queue_to_vmal
 
 
 void videobuf_queue_core_init(struct videobuf_queue *q,
-struct videobuf_queue_ops *ops,
+const struct videobuf_queue_ops *ops,
 struct device *dev,
 spinlock_t *irqlock,
 enum v4l2_buf_type type,
diff -puN 
drivers/media/video/videobuf-dma-contig.c~dvb-make-struct-videobuf_queue_ops-constant
 drivers/media/video/videobuf-dma-contig.c
--- 
a/drivers/media/video/videobuf-dma-contig.c~dvb-make-struct-videobuf_queue_ops-constant
+++ a/drivers/media/video/videobuf-dma-contig.c
@@ -428,7 +428,7 @@ static struct videobuf_qtype_ops qops = 
 };
 
 void videobuf_queue_dma_contig_init(struct videobuf_queue *q,
-   struct videobuf_queue_ops *ops,
+   const struct videobuf_queue_ops *ops,
struct device *dev,
spinlock_t *irqlock,
enum v4l2_buf_type type,
diff -puN 
drivers/media/video/videobuf-dma-sg.c~dvb-make-struct-videobuf_queue_ops-constant
 drivers/media/video/videobuf-dma-sg.c
--- 
a/drivers/media/video/videobuf-dma-sg.c~dvb-make-struct-videobuf_queue_ops-constant
+++ a/drivers/media/video/videobuf-dma-sg.c
@@ -702,7 +702,7 @@ void *videobuf_sg_alloc(size_t size)
 }
 
 void videobuf_queue_sg_init(struct videobuf_queue* q,
-struct videobuf_queue_ops *ops,
+const struct videobuf_queue_ops *ops,
 struct device *dev,
 spinlock_t *irqlock,
 enum v4l2_buf_type type,
diff -puN 
drivers/media/video/videobuf-vmalloc.c~dvb-make-struct-videobuf_queue_ops-constant
 drivers/media/video/videobuf-vmalloc.c
--- 
a/drivers/media/video/videobuf-vmalloc.c~dvb-make-struct-videobuf_queue_ops-constant
+++ a/drivers/media/video/videobuf-vmalloc.c
@@ -391,7 +391,7 @@ static struct videobuf_qtype_ops qops = 
 };
 
 void videobuf_queue_vmalloc_init(struct videobuf_queue* q,
-struct videobuf_queue_ops *ops,
+const struct videobuf_queue_ops *ops,
 void *dev,
 spinlock_t *irqlock,
 enum v4l2_buf_type type,
diff -puN 
include/media/videobuf-core.h~dvb-make-struct-videobuf_queue_ops-constant 
include/media/videobuf-core.h
--- a/include/media/videobuf-core.h~dvb-make-struct-videobuf_queue_ops-constant
+++ a/include/media/videobuf-core.h
@@ -166,7 +166,7 @@ struct videobuf_queue {
enum v4l2_fieldfield;
enum v4l2_fieldlast;   /* for field=V4L2_FIELD_ALTERNATE */
struct videobuf_buffer *bufs[VIDEO_MAX_FRAME];
-   struct videobuf_queue_ops  *ops;
+   const struct videobuf_queue_ops  *ops;
struct videobuf_qtype_ops  *int_ops;
 
unsigned int   streaming:1;
@@ -195,7 +195,7 @@ void *videobuf_queue_to_vmalloc (struct 
 struct videobuf_buffer *buf);
 
 void videobuf_queue_core_init(struct videobuf_queue *q,
-struct videobuf_queue_ops *ops,
+const struct videobuf_queue_ops *ops,
 struct device *dev,
 spinlock_t *irqlock,
 enum v4l2_buf_type type,
diff -puN 
include/media/videobuf-dma-contig.h~dvb-make-struct-videobuf_queue_ops-constant 
include/media/videobuf-dma-contig.h
--- 
a/include/media/videobuf-dma-contig.h~dvb-make-struct-videobuf_queue_ops-constant
+++ a/include/media/videobuf-dma-contig.h
@@ -17,7 +17,7 @@
 #include media/videobuf-core.h
 
 void videobuf_queue_dma_contig_init(struct videobuf_queue *q,

[patch 3/5] drivers/media/video: Move dereference after NULL test

2009-11-17 Thread akpm
From: Julia Lawall ju...@diku.dk

In quickcam_messenger.c, if the NULL test on uvd is needed, then the
dereference should be after the NULL test.

In vpif_display.c, std_info is initialized to the address of a structure
field.  This seems unlikely to be NULL.  If it could somehow be NULL, then
the assignment should be moved after the NULL test.  Alternatively, perhaps
the NULL test is intended to test std_info-stdid rather than std_info?

In saa7134-alsa.c, the function is only called from one place, where the
chip argument has already been dereferenced.  On the other hand, if it
should be kept, then card should be initialized after it.

A simplified version of the semantic match that detects this problem is as
follows (http://coccinelle.lip6.fr/):

// smpl
@match exists@
expression x, E;
identifier fld;
@@

* x-fld
  ... when != \(x = E\|x\)
* x == NULL
// /smpl

Signed-off-by: Julia Lawall ju...@diku.dk
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/davinci/vpif_display.c|2 --
 drivers/media/video/saa7134/saa7134-alsa.c|2 --
 drivers/media/video/usbvideo/quickcam_messenger.c |3 ++-
 3 files changed, 2 insertions(+), 5 deletions(-)

diff -puN 
drivers/media/video/davinci/vpif_display.c~drivers-media-video-move-dereference-after-null-test
 drivers/media/video/davinci/vpif_display.c
--- 
a/drivers/media/video/davinci/vpif_display.c~drivers-media-video-move-dereference-after-null-test
+++ a/drivers/media/video/davinci/vpif_display.c
@@ -383,8 +383,6 @@ static int vpif_get_std_info(struct chan
int index;
 
std_info-stdid = vid_ch-stdid;
-   if (!std_info)
-   return -1;
 
for (index = 0; index  ARRAY_SIZE(ch_params); index++) {
config = ch_params[index];
diff -puN 
drivers/media/video/saa7134/saa7134-alsa.c~drivers-media-video-move-dereference-after-null-test
 drivers/media/video/saa7134/saa7134-alsa.c
--- 
a/drivers/media/video/saa7134/saa7134-alsa.c~drivers-media-video-move-dereference-after-null-test
+++ a/drivers/media/video/saa7134/saa7134-alsa.c
@@ -1011,8 +1011,6 @@ static int snd_card_saa7134_new_mixer(sn
unsigned int idx;
int err, addr;
 
-   if (snd_BUG_ON(!chip))
-   return -EINVAL;
strcpy(card-mixername, SAA7134 Mixer);
 
for (idx = 0; idx  ARRAY_SIZE(snd_saa7134_volume_controls); idx++) {
diff -puN 
drivers/media/video/usbvideo/quickcam_messenger.c~drivers-media-video-move-dereference-after-null-test
 drivers/media/video/usbvideo/quickcam_messenger.c
--- 
a/drivers/media/video/usbvideo/quickcam_messenger.c~drivers-media-video-move-dereference-after-null-test
+++ a/drivers/media/video/usbvideo/quickcam_messenger.c
@@ -692,12 +692,13 @@ static int qcm_start_data(struct uvd *uv
 
 static void qcm_stop_data(struct uvd *uvd)
 {
-   struct qcm *cam = (struct qcm *) uvd-user_data;
+   struct qcm *cam;
int i, j;
int ret;
 
if ((uvd == NULL) || (!uvd-streaming) || (uvd-dev == NULL))
return;
+   cam = (struct qcm *) uvd-user_data;
 
ret = qcm_camera_off(uvd);
if (ret)
_
--
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 4/5] sms-cards: make id unsigned in sms_get_board()

2009-11-17 Thread akpm
From: Roel Kluin roel.kl...@gmail.com

Make id signed so we can't get an invalid pointer when we pass a negative
id.

Signed-off-by: Roel Kluin roel.kl...@gmail.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Michael Krufky mkru...@kernellabs.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/dvb/siano/sms-cards.c |2 +-
 drivers/media/dvb/siano/sms-cards.h |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff -puN 
drivers/media/dvb/siano/sms-cards.c~sms-cards-make-id-unsigned-in-sms_get_board 
drivers/media/dvb/siano/sms-cards.c
--- 
a/drivers/media/dvb/siano/sms-cards.c~sms-cards-make-id-unsigned-in-sms_get_board
+++ a/drivers/media/dvb/siano/sms-cards.c
@@ -97,7 +97,7 @@ static struct sms_board sms_boards[] = {
},
 };
 
-struct sms_board *sms_get_board(int id)
+struct sms_board *sms_get_board(unsigned id)
 {
BUG_ON(id = ARRAY_SIZE(sms_boards));
 
diff -puN 
drivers/media/dvb/siano/sms-cards.h~sms-cards-make-id-unsigned-in-sms_get_board 
drivers/media/dvb/siano/sms-cards.h
--- 
a/drivers/media/dvb/siano/sms-cards.h~sms-cards-make-id-unsigned-in-sms_get_board
+++ a/drivers/media/dvb/siano/sms-cards.h
@@ -81,7 +81,7 @@ struct sms_board {
int led_power, led_hi, led_lo, lna_ctrl, rf_switch;
 };
 
-struct sms_board *sms_get_board(int id);
+struct sms_board *sms_get_board(unsigned id);
 
 extern struct smscore_device_t *coredev;
 
_
--
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 1/5] konicawc.c: possible buffer overflow while use strncat

2009-11-17 Thread akpm
From: Alexander Strakh str...@ispras.ru

In driver ./drivers/media/video/usbvideo/konicawc.c in line 227:

227 usb_make_path(dev, cam-input_physname, 
sizeof(cam-input_physname));

After this line we use strncat:

228 strncat(cam-input_physname, /input0, 
sizeof(cam-input_physname));

where sizeof(cam-input_physname) returns length of cam-input_phisname
without length for null-symbol.  But this parameter must be - maximum
numbers of bytes to copy, i.e.:
sizeof(cam-input_physname)-strlen(cam-input_physname)-1.

In this case, after call to usb_make_path the similar drivers use strlcat.

Like in drivers/hid/usbhid/hid-core.c:
1152 usb_make_path(dev, hid-phys, sizeof(hid-phys));
1153 strlcat(hid-phys, /input, sizeof(hid-phys));

Found by Linux Driver Verification Project.

Use strlcat instead of strncat.

Signed-off-by: Alexander Strakh str...@ispras.ru
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/usbvideo/konicawc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/media/video/usbvideo/konicawc.c~konicawcc-possible-buffer-overflow-while-use-strncat
 drivers/media/video/usbvideo/konicawc.c
--- 
a/drivers/media/video/usbvideo/konicawc.c~konicawcc-possible-buffer-overflow-while-use-strncat
+++ a/drivers/media/video/usbvideo/konicawc.c
@@ -225,7 +225,7 @@ static void konicawc_register_input(stru
int error;
 
usb_make_path(dev, cam-input_physname, sizeof(cam-input_physname));
-   strncat(cam-input_physname, /input0, sizeof(cam-input_physname));
+   strlcat(cam-input_physname, /input0, sizeof(cam-input_physname));
 
cam-input = input_dev = input_allocate_device();
if (!input_dev) {
_
--
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 2/5] quickcam_messenger.c: possible buffer overflow while use strncat

2009-11-17 Thread akpm
From: Alexander Strakh str...@ispras.ru

In driver ./drivers/media/video/usbvideo/quickcam_messenger.c in line 91:

  91 usb_make_path(dev, cam-input_physname, 
sizeof(cam-input_physname));

After this line we use strncat:

  92 strncat(cam-input_physname, /input0, 
sizeof(cam-input_physname));

where sizeof(cam-input_physname) returns length of cam-input_phisname
without length for null-symbol.  But this parameter must be - maximum
numbers of bytes to copy, i.e.:
sizeof(cam-input_physname)-strlen(cam-input_physname)-1.

In this case, after call to usb_make_path the similar drivers use strlcat.

Like in: drivers/hid/usbhid/hid-core.c:
1152 usb_make_path(dev, hid-phys, sizeof(hid-phys));
1153 strlcat(hid-phys, /input, sizeof(hid-phys));

Found by Linux Driver Verification Project.

Use strlcat instead of strncat.

Signed-off-by: Alexander Strakh str...@ispras.ru
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/usbvideo/quickcam_messenger.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/media/video/usbvideo/quickcam_messenger.c~quickcam_messengerc-possible-buffer-overflow-while-use-strncat
 drivers/media/video/usbvideo/quickcam_messenger.c
--- 
a/drivers/media/video/usbvideo/quickcam_messenger.c~quickcam_messengerc-possible-buffer-overflow-while-use-strncat
+++ a/drivers/media/video/usbvideo/quickcam_messenger.c
@@ -89,7 +89,7 @@ static void qcm_register_input(struct qc
int error;
 
usb_make_path(dev, cam-input_physname, sizeof(cam-input_physname));
-   strncat(cam-input_physname, /input0, sizeof(cam-input_physname));
+   strlcat(cam-input_physname, /input0, sizeof(cam-input_physname));
 
cam-input = input_dev = input_allocate_device();
if (!input_dev) {
_
--
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 6/9] drivers/media/dvb: Use dst_type field instead of type_flags

2009-08-06 Thread akpm
From: Julia Lawall ju...@diku.dk

It seems from other code that it is the dst_type field rather than the
type_flags field that contains values of the form DST_TYPE_IS...
The type_flags field contains values of the form DST_TYPE_HAS...

The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// smpl
@@ struct dst_state E; @@

(
*E.type_flags ==
  \( DST_TYPE_IS_SAT\|DST_TYPE_IS_TERR\|DST_TYPE_IS_CABLE\|DST_TYPE_IS_ATSC \)
|
*E.type_flags !=
  \( DST_TYPE_IS_SAT\|DST_TYPE_IS_TERR\|DST_TYPE_IS_CABLE\|DST_TYPE_IS_ATSC \)
)
// /smpl

Signed-off-by: Julia Lawall ju...@diku.dk
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/dvb/bt8xx/dst.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/media/dvb/bt8xx/dst.c~drivers-media-dvb-use-dst_type-field-instead-of-type_flags
 drivers/media/dvb/bt8xx/dst.c
--- 
a/drivers/media/dvb/bt8xx/dst.c~drivers-media-dvb-use-dst_type-field-instead-of-type_flags
+++ a/drivers/media/dvb/bt8xx/dst.c
@@ -1059,7 +1059,7 @@ static int dst_get_tuner_info(struct dst
dprintk(verbose, DST_ERROR, 1, DST type has TS=188);
}
if (state-board_info[0] == 0xbc) {
-   if (state-type_flags != DST_TYPE_IS_ATSC)
+   if (state-dst_type != DST_TYPE_IS_ATSC)
state-type_flags |= DST_TYPE_HAS_TS188;
else
state-type_flags |= DST_TYPE_HAS_NEWTUNE_2;
_
--
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 7/9] stk-webcam: read buffer overflow

2009-08-06 Thread akpm
From: Roel Kluin roel.kl...@gmail.com

It tested the value of stk_sizes[i].m before checking whether i was in range.

Signed-off-by: Roel Kluin roel.kl...@gmail.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Hans Verkuil hverk...@xs4all.nl
Cc: Trent Piepho xy...@speakeasy.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/stk-webcam.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -puN drivers/media/video/stk-webcam.c~stk-webcam-read-buffer-overflow 
drivers/media/video/stk-webcam.c
--- a/drivers/media/video/stk-webcam.c~stk-webcam-read-buffer-overflow
+++ a/drivers/media/video/stk-webcam.c
@@ -1050,8 +1050,8 @@ static int stk_setup_format(struct stk_c
depth = 1;
else
depth = 2;
-   while (stk_sizes[i].m != dev-vsettings.mode
-i  ARRAY_SIZE(stk_sizes))
+   while (i  ARRAY_SIZE(stk_sizes) 
+   stk_sizes[i].m != dev-vsettings.mode)
i++;
if (i == ARRAY_SIZE(stk_sizes)) {
STK_ERROR(Something is broken in %s\n, __func__);
_
--
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 3/6] vino: replace dma_sync_single with dma_sync_single_for_cpu

2009-06-10 Thread akpm
From: FUJITA Tomonori fujita.tomon...@lab.ntt.co.jp

This replaces dma_sync_single() with dma_sync_single_for_cpu() because
dma_sync_single() is an obsolete API; include/linux/dma-mapping.h says:

/* Backwards compat, remove in 2.7.x */
#define dma_sync_single dma_sync_single_for_cpu
#define dma_sync_sg dma_sync_sg_for_cpu

Signed-off-by: FUJITA Tomonori fujita.tomon...@lab.ntt.co.jp
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/vino.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff -puN 
drivers/media/video/vino.c~vino-replace-dma_sync_single-with-dma_sync_single_for_cpu
 drivers/media/video/vino.c
--- 
a/drivers/media/video/vino.c~vino-replace-dma_sync_single-with-dma_sync_single_for_cpu
+++ a/drivers/media/video/vino.c
@@ -868,9 +868,9 @@ static void vino_sync_buffer(struct vino
dprintk(vino_sync_buffer():\n);
 
for (i = 0; i  fb-desc_table.page_count; i++)
-   dma_sync_single(NULL,
-   fb-desc_table.dma_cpu[VINO_PAGE_RATIO * i],
-   PAGE_SIZE, DMA_FROM_DEVICE);
+   dma_sync_single_for_cpu(NULL,
+   fb-desc_table.dma_cpu[VINO_PAGE_RATIO 
* i],
+   PAGE_SIZE, DMA_FROM_DEVICE);
 }
 
 /* Framebuffer fifo functions (need to be locked externally) */
_
--
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 1/6] radio-mr800.c: missing mutex include

2009-06-10 Thread akpm
From: Alessio Igor Bogani abog...@texware.it

radio-mr800.c uses struct mutex, so while linux/mutex.h seems to be
pulled in indirectly by one of the headers it already includes, the right
thing is to include it directly.

Signed-off-by: Alessio Igor Bogani abog...@texware.it
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/radio/radio-mr800.c |1 +
 1 file changed, 1 insertion(+)

diff -puN drivers/media/radio/radio-mr800.c~radio-mr800c-missing-mutex-include 
drivers/media/radio/radio-mr800.c
--- a/drivers/media/radio/radio-mr800.c~radio-mr800c-missing-mutex-include
+++ a/drivers/media/radio/radio-mr800.c
@@ -64,6 +64,7 @@
 #include media/v4l2-ioctl.h
 #include linux/usb.h
 #include linux/version.h /* for KERNEL_VERSION MACRO */
+#include linux/mutex.h
 
 /* driver and module definitions */
 #define DRIVER_AUTHOR Alexey Klimov klimov.li...@gmail.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 5/6] v4l: generate KEY_CAMERA instead of BTN_0 key events on input devices

2009-06-10 Thread akpm
From: Lennart Poettering mzxre...@0pointer.de

A bunch of V4L drivers generate BTN_0 instead of KEY_CAMERA key presses.

X11 is able to handle KEY_CAMERA automatically these days while BTN_0 is
not treated at all.  Thus it would be of big benefit if the camera drivers
would consistently generate KEY_CAMERA.  Some drivers (uvc) already do,
this patch updates the remaining drivers to do the same.

I only possess a limited set of webcams, so this isn't tested with all
cameras.  The patch is rather trivial and compile tested, so I'd say it's
still good enough to get merged.

Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Lennart Poettering mzxre...@0pointer.de
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/pwc/pwc-if.c  |4 ++--
 drivers/media/video/usbvideo/konicawc.c   |4 ++--
 drivers/media/video/usbvideo/quickcam_messenger.c |4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff -puN 
drivers/media/video/pwc/pwc-if.c~v4l-generate-key_camera-instead-of-btn_0-key-events-on-input-devices
 drivers/media/video/pwc/pwc-if.c
--- 
a/drivers/media/video/pwc/pwc-if.c~v4l-generate-key_camera-instead-of-btn_0-key-events-on-input-devices
+++ a/drivers/media/video/pwc/pwc-if.c
@@ -601,7 +601,7 @@ static void pwc_snapshot_button(struct p
 
 #ifdef CONFIG_USB_PWC_INPUT_EVDEV
if (pdev-button_dev) {
-   input_report_key(pdev-button_dev, BTN_0, down);
+   input_report_key(pdev-button_dev, KEY_CAMERA, down);
input_sync(pdev-button_dev);
}
 #endif
@@ -1847,7 +1847,7 @@ static int usb_pwc_probe(struct usb_inte
usb_to_input_id(pdev-udev, pdev-button_dev-id);
pdev-button_dev-dev.parent = pdev-udev-dev;
pdev-button_dev-evbit[0] = BIT_MASK(EV_KEY);
-   pdev-button_dev-keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0);
+   pdev-button_dev-keybit[BIT_WORD(KEY_CAMERA)] = BIT_MASK(KEY_CAMERA);
 
rc = input_register_device(pdev-button_dev);
if (rc) {
diff -puN 
drivers/media/video/usbvideo/konicawc.c~v4l-generate-key_camera-instead-of-btn_0-key-events-on-input-devices
 drivers/media/video/usbvideo/konicawc.c
--- 
a/drivers/media/video/usbvideo/konicawc.c~v4l-generate-key_camera-instead-of-btn_0-key-events-on-input-devices
+++ a/drivers/media/video/usbvideo/konicawc.c
@@ -240,7 +240,7 @@ static void konicawc_register_input(stru
input_dev-dev.parent = dev-dev;
 
input_dev-evbit[0] = BIT_MASK(EV_KEY);
-   input_dev-keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0);
+   input_dev-keybit[BIT_WORD(KEY_CAMERA)] = BIT_MASK(KEY_CAMERA);
 
error = input_register_device(cam-input);
if (error) {
@@ -263,7 +263,7 @@ static void konicawc_unregister_input(st
 static void konicawc_report_buttonstat(struct konicawc *cam)
 {
if (cam-input) {
-   input_report_key(cam-input, BTN_0, cam-buttonsts);
+   input_report_key(cam-input, KEY_CAMERA, cam-buttonsts);
input_sync(cam-input);
}
 }
diff -puN 
drivers/media/video/usbvideo/quickcam_messenger.c~v4l-generate-key_camera-instead-of-btn_0-key-events-on-input-devices
 drivers/media/video/usbvideo/quickcam_messenger.c
--- 
a/drivers/media/video/usbvideo/quickcam_messenger.c~v4l-generate-key_camera-instead-of-btn_0-key-events-on-input-devices
+++ a/drivers/media/video/usbvideo/quickcam_messenger.c
@@ -103,7 +103,7 @@ static void qcm_register_input(struct qc
input_dev-dev.parent = dev-dev;
 
input_dev-evbit[0] = BIT_MASK(EV_KEY);
-   input_dev-keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0);
+   input_dev-keybit[BIT_WORD(KEY_CAMERA)] = BIT_MASK(KEY_CAMERA);
 
error = input_register_device(cam-input);
if (error) {
@@ -126,7 +126,7 @@ static void qcm_unregister_input(struct 
 static void qcm_report_buttonstat(struct qcm *cam)
 {
if (cam-input) {
-   input_report_key(cam-input, BTN_0, cam-button_sts);
+   input_report_key(cam-input, KEY_CAMERA, cam-button_sts);
input_sync(cam-input);
}
 }
_
--
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 4/6] V4L/pwc: use usb_interface as parent, not usb_device

2009-06-10 Thread akpm
From: Lennart Poettering mzxre...@0pointer.de

The current code creates a sysfs device path where the video4linux device
is child of the usb device itself instead of the interface it belongs to. 
That is evil and confuses udev.

This patch does basically the same thing as Kay's similar patch for the
ov511 driver:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=ce96d0a44a4f8d1bb3dc12b5e98cb688c1bc730d

Cc: Kay Sievers kay.siev...@vrfy.org
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Lennart Poettering mzxre...@0pointer.de
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/pwc/pwc-if.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/media/video/pwc/pwc-if.c~v4l-pwc-use-usb_interface-as-parent-not-usb_device
 drivers/media/video/pwc/pwc-if.c
--- 
a/drivers/media/video/pwc/pwc-if.c~v4l-pwc-use-usb_interface-as-parent-not-usb_device
+++ a/drivers/media/video/pwc/pwc-if.c
@@ -1783,7 +1783,7 @@ static int usb_pwc_probe(struct usb_inte
return -ENOMEM;
}
memcpy(pdev-vdev, pwc_template, sizeof(pwc_template));
-   pdev-vdev-parent = (udev-dev);
+   pdev-vdev-parent = intf-dev;
strcpy(pdev-vdev-name, name);
video_set_drvdata(pdev-vdev, pdev);
 
_
--
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 6/6] tvp514x: try_count off by one

2009-06-10 Thread akpm
From: Roel Kluin roel.kl...@gmail.com

With `while (try_count--  0)' try_count reaches -1 after the loop.

Signed-off-by: Roel Kluin roel.kl...@gmail.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/tvp514x.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/media/video/tvp514x.c~tvp514x-try_count-off-by-one 
drivers/media/video/tvp514x.c
--- a/drivers/media/video/tvp514x.c~tvp514x-try_count-off-by-one
+++ a/drivers/media/video/tvp514x.c
@@ -692,7 +692,7 @@ static int ioctl_s_routing(struct v4l2_i
break;  /* Input detected */
}
 
-   if ((current_std == STD_INVALID) || (try_count = 0))
+   if ((current_std == STD_INVALID) || (try_count  0))
return -EINVAL;
 
decoder-current_std = current_std;
_
--
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 2/6] dvb-core: fix potential mutex_unlock without mutex_lock in dvb_dvr_read

2009-06-10 Thread akpm
From: Simon Arlott si...@fire.lp0.eu

dvb_dvr_read may unlock the dmxdev mutex and return -ENODEV, except this
function is a file op and will never be called with the mutex held.

There's existing mutex_lock and mutex_unlock around the actual read but
it's commented out.  These should probably be uncommented but the read
blocks and this could block another non-blocking reader on the mutex
instead.

This change comments out the extra mutex_unlock.

[a...@linux-foundation.org: cleanups, simplification]
Signed-off-by: Simon Arlott si...@fire.lp0.eu
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/dvb/dvb-core/dmxdev.c |   14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff -puN 
drivers/media/dvb/dvb-core/dmxdev.c~dvb-core-fix-potential-mutex_unlock-without-mutex_lock-in-dvb_dvr_read
 drivers/media/dvb/dvb-core/dmxdev.c
--- 
a/drivers/media/dvb/dvb-core/dmxdev.c~dvb-core-fix-potential-mutex_unlock-without-mutex_lock-in-dvb_dvr_read
+++ a/drivers/media/dvb/dvb-core/dmxdev.c
@@ -244,19 +244,13 @@ static ssize_t dvb_dvr_read(struct file 
 {
struct dvb_device *dvbdev = file-private_data;
struct dmxdev *dmxdev = dvbdev-priv;
-   int ret;
 
-   if (dmxdev-exit) {
-   mutex_unlock(dmxdev-mutex);
+   if (dmxdev-exit)
return -ENODEV;
-   }
 
-   //mutex_lock(dmxdev-mutex);
-   ret = dvb_dmxdev_buffer_read(dmxdev-dvr_buffer,
-file-f_flags  O_NONBLOCK,
-buf, count, ppos);
-   //mutex_unlock(dmxdev-mutex);
-   return ret;
+   return dvb_dmxdev_buffer_read(dmxdev-dvr_buffer,
+ file-f_flags  O_NONBLOCK,
+ buf, count, ppos);
 }
 
 static int dvb_dvr_set_buffer_size(struct dmxdev *dmxdev,
_
--
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 3/4] dvb-core: fix potential mutex_unlock without mutex_lock in dvb_dvr_read

2009-05-12 Thread akpm
From: Simon Arlott si...@fire.lp0.eu

dvb_dvr_read may unlock the dmxdev mutex and return -ENODEV, except this
function is a file op and will never be called with the mutex held.

There's existing mutex_lock and mutex_unlock around the actual read but
it's commented out.  These should probably be uncommented but the read
blocks and this could block another non-blocking reader on the mutex
instead.

This change comments out the extra mutex_unlock.

[a...@linux-foundation.org: cleanups, simplification]
Signed-off-by: Simon Arlott si...@fire.lp0.eu
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/dvb/dvb-core/dmxdev.c |   14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff -puN 
drivers/media/dvb/dvb-core/dmxdev.c~dvb-core-fix-potential-mutex_unlock-without-mutex_lock-in-dvb_dvr_read
 drivers/media/dvb/dvb-core/dmxdev.c
--- 
a/drivers/media/dvb/dvb-core/dmxdev.c~dvb-core-fix-potential-mutex_unlock-without-mutex_lock-in-dvb_dvr_read
+++ a/drivers/media/dvb/dvb-core/dmxdev.c
@@ -244,19 +244,13 @@ static ssize_t dvb_dvr_read(struct file 
 {
struct dvb_device *dvbdev = file-private_data;
struct dmxdev *dmxdev = dvbdev-priv;
-   int ret;
 
-   if (dmxdev-exit) {
-   mutex_unlock(dmxdev-mutex);
+   if (dmxdev-exit)
return -ENODEV;
-   }
 
-   //mutex_lock(dmxdev-mutex);
-   ret = dvb_dmxdev_buffer_read(dmxdev-dvr_buffer,
-file-f_flags  O_NONBLOCK,
-buf, count, ppos);
-   //mutex_unlock(dmxdev-mutex);
-   return ret;
+   return dvb_dmxdev_buffer_read(dmxdev-dvr_buffer,
+ file-f_flags  O_NONBLOCK,
+ buf, count, ppos);
 }
 
 static int dvb_dvr_set_buffer_size(struct dmxdev *dmxdev,
_
--
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 1/4] radio-mr800.c: missing mutex include

2009-05-12 Thread akpm
From: Alessio Igor Bogani abog...@texware.it

radio-mr800.c uses struct mutex, so while linux/mutex.h seems to be
pulled in indirectly by one of the headers it already includes, the right
thing is to include it directly.

Signed-off-by: Alessio Igor Bogani abog...@texware.it
Cc: Mauro Carvalho Chehab mche...@infradead.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/radio/radio-mr800.c |1 +
 1 file changed, 1 insertion(+)

diff -puN drivers/media/radio/radio-mr800.c~radio-mr800c-missing-mutex-include 
drivers/media/radio/radio-mr800.c
--- a/drivers/media/radio/radio-mr800.c~radio-mr800c-missing-mutex-include
+++ a/drivers/media/radio/radio-mr800.c
@@ -64,6 +64,7 @@
 #include media/v4l2-ioctl.h
 #include linux/usb.h
 #include linux/version.h /* for KERNEL_VERSION MACRO */
+#include linux/mutex.h
 
 /* driver and module definitions */
 #define DRIVER_AUTHOR Alexey Klimov klimov.li...@gmail.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 2/4] V4L/DVB: cimax2.c: fix / typo

2009-05-12 Thread akpm
From: Roel Kluin roel.kl...@gmail.com

binary/logical and typo

Signed-off-by: Roel Kluin roel.kl...@gmail.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Abylay Ospan aos...@netup.ru
Cc: Igor M. Liplianin liplia...@netup.ru
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 drivers/media/video/cx23885/cimax2.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/media/video/cx23885/cimax2.c~v4l-dvb-cimax2c-fix-typo 
drivers/media/video/cx23885/cimax2.c
--- a/drivers/media/video/cx23885/cimax2.c~v4l-dvb-cimax2c-fix-typo
+++ a/drivers/media/video/cx23885/cimax2.c
@@ -312,7 +312,7 @@ static void netup_read_ci_status(struct 
TS config = %02x\n, __func__, state-ci_i2c_addr, 0, buf[0],
buf[32]);
 
-   if (buf[0]  1)
+   if (buf[0]  1)
state-status = DVB_CA_EN50221_POLL_CAM_PRESENT |
DVB_CA_EN50221_POLL_CAM_READY;
else
_
--
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