mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 14:42:24 +00:00
Merge branch 'upstream-fixes' into patchwork
Merge the media fixes merged upstream for v3.13-rc4 * upstream-fixes: (30 commits) [media] videobuf2-dma-sg: fix possible memory leak [media] vb2: regression fix: always set length field. [media] mt9p031: Include linux/of.h header [media] rtl2830: add parent for I2C adapter [media] media: marvell-ccic: use devm to release clk [media] ths7303: Declare as static a private function [media] em28xx-video: Swap release order to avoid lock nesting [media] usbtv: Add support for PAL video source [media] media_tree: Fix spelling errors [media] videobuf2: Add support for file access mode flags for DMABUF exporting [media] radio-shark2: Mark shark_resume_leds() inline to kill compiler warning [media] radio-shark: Mark shark_resume_leds() inline to kill compiler warning [media] af9035: unlock on error in af9035_i2c_master_xfer() [media] af9033: fix broken I2C [media] v4l: omap3isp: Don't check for missing get_fmt op on remote subdev [media] af9035: fix broken I2C and USB I/O [media] wm8775: fix broken audio routing [media] marvell-ccic: drop resource free in driver remove [media] tef6862/radio-tea5764: actually assign clamp result [media] cx231xx: use after free on error path in probe ...
This commit is contained in:
commit
675722b0e3
@ -1032,8 +1032,13 @@ static int dmx_section_feed_release_filter(struct dmx_section_feed *feed,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (feed->is_filtering)
|
||||
if (feed->is_filtering) {
|
||||
/* release dvbdmx->mutex as far as it is
|
||||
acquired by stop_filtering() itself */
|
||||
mutex_unlock(&dvbdmx->mutex);
|
||||
feed->stop_filtering(feed);
|
||||
mutex_lock(&dvbdmx->mutex);
|
||||
}
|
||||
|
||||
spin_lock_irq(&dvbdmx->lock);
|
||||
f = dvbdmxfeed->filter;
|
||||
|
@ -170,18 +170,18 @@ static int af9033_rd_reg_mask(struct af9033_state *state, u32 reg, u8 *val,
|
||||
static int af9033_wr_reg_val_tab(struct af9033_state *state,
|
||||
const struct reg_val *tab, int tab_len)
|
||||
{
|
||||
#define MAX_TAB_LEN 212
|
||||
int ret, i, j;
|
||||
u8 buf[MAX_XFER_SIZE];
|
||||
|
||||
if (tab_len > sizeof(buf)) {
|
||||
dev_warn(&state->i2c->dev,
|
||||
"%s: i2c wr len=%d is too big!\n",
|
||||
KBUILD_MODNAME, tab_len);
|
||||
return -EINVAL;
|
||||
}
|
||||
u8 buf[1 + MAX_TAB_LEN];
|
||||
|
||||
dev_dbg(&state->i2c->dev, "%s: tab_len=%d\n", __func__, tab_len);
|
||||
|
||||
if (tab_len > sizeof(buf)) {
|
||||
dev_warn(&state->i2c->dev, "%s: tab len %d is too big\n",
|
||||
KBUILD_MODNAME, tab_len);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (i = 0, j = 0; i < tab_len; i++) {
|
||||
buf[j] = tab[i].val;
|
||||
|
||||
|
@ -78,7 +78,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe)
|
||||
|
||||
num = if_freq / 1000; /* Hz => kHz */
|
||||
num *= 0x4000;
|
||||
if_ctl = cxd2820r_div_u64_round_closest(num, 41000);
|
||||
if_ctl = 0x4000 - cxd2820r_div_u64_round_closest(num, 41000);
|
||||
buf[0] = (if_ctl >> 8) & 0x3f;
|
||||
buf[1] = (if_ctl >> 0) & 0xff;
|
||||
|
||||
|
@ -130,12 +130,10 @@ static int wm8775_s_routing(struct v4l2_subdev *sd,
|
||||
return -EINVAL;
|
||||
}
|
||||
state->input = input;
|
||||
if (!v4l2_ctrl_g_ctrl(state->mute))
|
||||
if (v4l2_ctrl_g_ctrl(state->mute))
|
||||
return 0;
|
||||
if (!v4l2_ctrl_g_ctrl(state->vol))
|
||||
return 0;
|
||||
if (!v4l2_ctrl_g_ctrl(state->bal))
|
||||
return 0;
|
||||
wm8775_set_audio(sd, 1);
|
||||
return 0;
|
||||
}
|
||||
|
@ -4182,7 +4182,8 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)
|
||||
}
|
||||
btv->std = V4L2_STD_PAL;
|
||||
init_irqreg(btv);
|
||||
v4l2_ctrl_handler_setup(hdl);
|
||||
if (!bttv_tvcards[btv->c.type].no_video)
|
||||
v4l2_ctrl_handler_setup(hdl);
|
||||
if (hdl->error) {
|
||||
result = hdl->error;
|
||||
goto fail2;
|
||||
|
@ -1354,9 +1354,11 @@ static int saa7164_initdev(struct pci_dev *pci_dev,
|
||||
if (fw_debug) {
|
||||
dev->kthread = kthread_run(saa7164_thread_function, dev,
|
||||
"saa7164 debug");
|
||||
if (!dev->kthread)
|
||||
if (IS_ERR(dev->kthread)) {
|
||||
dev->kthread = NULL;
|
||||
printk(KERN_ERR "%s() Failed to create "
|
||||
"debug kernel thread\n", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
} /* != BOARD_UNKNOWN */
|
||||
|
@ -290,14 +290,11 @@ __isp_video_get_format(struct isp_video *video, struct v4l2_format *format)
|
||||
if (subdev == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&video->mutex);
|
||||
|
||||
fmt.pad = pad;
|
||||
fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
|
||||
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
|
||||
if (ret == -ENOIOCTLCMD)
|
||||
ret = -EINVAL;
|
||||
|
||||
mutex_lock(&video->mutex);
|
||||
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
|
||||
mutex_unlock(&video->mutex);
|
||||
|
||||
if (ret)
|
||||
|
@ -1039,8 +1039,10 @@ int vsp1_video_init(struct vsp1_video *video, struct vsp1_entity *rwpf)
|
||||
|
||||
/* ... and the buffers queue... */
|
||||
video->alloc_ctx = vb2_dma_contig_init_ctx(video->vsp1->dev);
|
||||
if (IS_ERR(video->alloc_ctx))
|
||||
if (IS_ERR(video->alloc_ctx)) {
|
||||
ret = PTR_ERR(video->alloc_ctx);
|
||||
goto error;
|
||||
}
|
||||
|
||||
video->queue.type = video->type;
|
||||
video->queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF;
|
||||
|
@ -356,7 +356,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
|
||||
So we keep it as-is. */
|
||||
return -EINVAL;
|
||||
}
|
||||
clamp(freq, FREQ_MIN * FREQ_MUL, FREQ_MAX * FREQ_MUL);
|
||||
freq = clamp(freq, FREQ_MIN * FREQ_MUL, FREQ_MAX * FREQ_MUL);
|
||||
tea5764_power_up(radio);
|
||||
tea5764_tune(radio, (freq * 125) / 2);
|
||||
return 0;
|
||||
|
@ -112,7 +112,7 @@ static int tef6862_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequen
|
||||
if (f->tuner != 0)
|
||||
return -EINVAL;
|
||||
|
||||
clamp(freq, TEF6862_LO_FREQ, TEF6862_HI_FREQ);
|
||||
freq = clamp(freq, TEF6862_LO_FREQ, TEF6862_HI_FREQ);
|
||||
pll = 1964 + ((freq - TEF6862_LO_FREQ) * 20) / FREQ_MUL;
|
||||
i2cmsg[0] = (MSA_MODE_PRESET << MSA_MODE_SHIFT) | WM_SUB_PLLM;
|
||||
i2cmsg[1] = (pll >> 8) & 0xff;
|
||||
|
@ -1412,8 +1412,8 @@ err_v4l2:
|
||||
usb_set_intfdata(interface, NULL);
|
||||
err_if:
|
||||
usb_put_dev(udev);
|
||||
kfree(dev);
|
||||
clear_bit(dev->devno, &cx231xx_devused);
|
||||
kfree(dev);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ static int af9035_wr_regs(struct dvb_usb_device *d, u32 reg, u8 *val, int len)
|
||||
{
|
||||
u8 wbuf[MAX_XFER_SIZE];
|
||||
u8 mbox = (reg >> 16) & 0xff;
|
||||
struct usb_req req = { CMD_MEM_WR, mbox, sizeof(wbuf), wbuf, 0, NULL };
|
||||
struct usb_req req = { CMD_MEM_WR, mbox, 6 + len, wbuf, 0, NULL };
|
||||
|
||||
if (6 + len > sizeof(wbuf)) {
|
||||
dev_warn(&d->udev->dev, "%s: i2c wr: len=%d is too big!\n",
|
||||
@ -238,14 +238,15 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
|
||||
} else {
|
||||
/* I2C */
|
||||
u8 buf[MAX_XFER_SIZE];
|
||||
struct usb_req req = { CMD_I2C_RD, 0, sizeof(buf),
|
||||
struct usb_req req = { CMD_I2C_RD, 0, 5 + msg[0].len,
|
||||
buf, msg[1].len, msg[1].buf };
|
||||
|
||||
if (5 + msg[0].len > sizeof(buf)) {
|
||||
dev_warn(&d->udev->dev,
|
||||
"%s: i2c xfer: len=%d is too big!\n",
|
||||
KBUILD_MODNAME, msg[0].len);
|
||||
return -EOPNOTSUPP;
|
||||
ret = -EOPNOTSUPP;
|
||||
goto unlock;
|
||||
}
|
||||
req.mbox |= ((msg[0].addr & 0x80) >> 3);
|
||||
buf[0] = msg[1].len;
|
||||
@ -274,14 +275,15 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
|
||||
} else {
|
||||
/* I2C */
|
||||
u8 buf[MAX_XFER_SIZE];
|
||||
struct usb_req req = { CMD_I2C_WR, 0, sizeof(buf), buf,
|
||||
0, NULL };
|
||||
struct usb_req req = { CMD_I2C_WR, 0, 5 + msg[0].len,
|
||||
buf, 0, NULL };
|
||||
|
||||
if (5 + msg[0].len > sizeof(buf)) {
|
||||
dev_warn(&d->udev->dev,
|
||||
"%s: i2c xfer: len=%d is too big!\n",
|
||||
KBUILD_MODNAME, msg[0].len);
|
||||
return -EOPNOTSUPP;
|
||||
ret = -EOPNOTSUPP;
|
||||
goto unlock;
|
||||
}
|
||||
req.mbox |= ((msg[0].addr & 0x80) >> 3);
|
||||
buf[0] = msg[0].len;
|
||||
@ -319,6 +321,7 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
|
||||
ret = -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
unlock:
|
||||
mutex_unlock(&d->i2c_mutex);
|
||||
|
||||
if (ret < 0)
|
||||
|
@ -102,7 +102,7 @@ static int technisat_usb2_i2c_access(struct usb_device *udev,
|
||||
if (rxlen > 62) {
|
||||
err("i2c RX buffer can't exceed 62 bytes (dev 0x%02x)",
|
||||
device_addr);
|
||||
txlen = 62;
|
||||
rxlen = 62;
|
||||
}
|
||||
|
||||
b[0] = I2C_SPEED_100KHZ_BIT;
|
||||
|
@ -361,6 +361,9 @@ static void stk1135_configure_clock(struct gspca_dev *gspca_dev)
|
||||
|
||||
/* set serial interface clock divider (30MHz/0x1f*16+2) = 60240 kHz) */
|
||||
reg_w(gspca_dev, STK1135_REG_SICTL + 2, 0x1f);
|
||||
|
||||
/* wait a while for sensor to catch up */
|
||||
udelay(1000);
|
||||
}
|
||||
|
||||
static void stk1135_camera_disable(struct gspca_dev *gspca_dev)
|
||||
|
@ -1027,6 +1027,7 @@ static const struct usb_device_id device_table[] = {
|
||||
{USB_DEVICE(0x055f, 0xc650), BS(SPCA533, 0)},
|
||||
{USB_DEVICE(0x05da, 0x1018), BS(SPCA504B, 0)},
|
||||
{USB_DEVICE(0x06d6, 0x0031), BS(SPCA533, 0)},
|
||||
{USB_DEVICE(0x06d6, 0x0041), BS(SPCA504B, 0)},
|
||||
{USB_DEVICE(0x0733, 0x1311), BS(SPCA533, 0)},
|
||||
{USB_DEVICE(0x0733, 0x1314), BS(SPCA533, 0)},
|
||||
{USB_DEVICE(0x0733, 0x2211), BS(SPCA533, 0)},
|
||||
|
@ -144,6 +144,25 @@ static void __vb2_buf_dmabuf_put(struct vb2_buffer *vb)
|
||||
__vb2_plane_dmabuf_put(q, &vb->planes[plane]);
|
||||
}
|
||||
|
||||
/**
|
||||
* __setup_lengths() - setup initial lengths for every plane in
|
||||
* every buffer on the queue
|
||||
*/
|
||||
static void __setup_lengths(struct vb2_queue *q, unsigned int n)
|
||||
{
|
||||
unsigned int buffer, plane;
|
||||
struct vb2_buffer *vb;
|
||||
|
||||
for (buffer = q->num_buffers; buffer < q->num_buffers + n; ++buffer) {
|
||||
vb = q->bufs[buffer];
|
||||
if (!vb)
|
||||
continue;
|
||||
|
||||
for (plane = 0; plane < vb->num_planes; ++plane)
|
||||
vb->v4l2_planes[plane].length = q->plane_sizes[plane];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* __setup_offsets() - setup unique offsets ("cookies") for every plane in
|
||||
* every buffer on the queue
|
||||
@ -169,7 +188,6 @@ static void __setup_offsets(struct vb2_queue *q, unsigned int n)
|
||||
continue;
|
||||
|
||||
for (plane = 0; plane < vb->num_planes; ++plane) {
|
||||
vb->v4l2_planes[plane].length = q->plane_sizes[plane];
|
||||
vb->v4l2_planes[plane].m.mem_offset = off;
|
||||
|
||||
dprintk(3, "Buffer %d, plane %d offset 0x%08lx\n",
|
||||
@ -241,6 +259,7 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum v4l2_memory memory,
|
||||
q->bufs[q->num_buffers + buffer] = vb;
|
||||
}
|
||||
|
||||
__setup_lengths(q, buffer);
|
||||
if (memory == V4L2_MEMORY_MMAP)
|
||||
__setup_offsets(q, buffer);
|
||||
|
||||
|
@ -185,7 +185,7 @@ static void *vb2_dma_sg_get_userptr(void *alloc_ctx, unsigned long vaddr,
|
||||
buf->pages = kzalloc(buf->num_pages * sizeof(struct page *),
|
||||
GFP_KERNEL);
|
||||
if (!buf->pages)
|
||||
return NULL;
|
||||
goto userptr_fail_alloc_pages;
|
||||
|
||||
vma = find_vma(current->mm, vaddr);
|
||||
if (!vma) {
|
||||
@ -245,6 +245,7 @@ userptr_fail_get_user_pages:
|
||||
vb2_put_vma(buf->vma);
|
||||
userptr_fail_find_vma:
|
||||
kfree(buf->pages);
|
||||
userptr_fail_alloc_pages:
|
||||
kfree(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user