Skip to content

Commit 69cc1f9

Browse files
Malcolm Priestleygregkh
authored andcommitted
staging: vt6656: limit reg output to block size
vnt_control_out appears to fail when BBREG is greater than 64 writes. Create new function that will relay an array in no larger than the indicated block size. It appears that this command has always failed but was ignored by driver until the introduction of error checking. Cc: stable <[email protected]> # v5.3+ Signed-off-by: Malcolm Priestley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7de6155 commit 69cc1f9

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

drivers/staging/vt6656/baseband.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,8 @@ int vnt_vt3184_init(struct vnt_private *priv)
449449

450450
memcpy(array, addr, length);
451451

452-
ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0,
453-
MESSAGE_REQUEST_BBREG, length, array);
452+
ret = vnt_control_out_blocks(priv, VNT_REG_BLOCK_SIZE,
453+
MESSAGE_REQUEST_BBREG, length, array);
454454
if (ret)
455455
goto end;
456456

drivers/staging/vt6656/usbpipe.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,23 @@ int vnt_control_out_u8(struct vnt_private *priv, u8 reg, u8 reg_off, u8 data)
7676
reg_off, reg, sizeof(u8), &data);
7777
}
7878

79+
int vnt_control_out_blocks(struct vnt_private *priv,
80+
u16 block, u8 reg, u16 length, u8 *data)
81+
{
82+
int ret = 0, i;
83+
84+
for (i = 0; i < length; i += block) {
85+
u16 len = min_t(int, length - i, block);
86+
87+
ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE,
88+
i, reg, len, data + i);
89+
if (ret)
90+
goto end;
91+
}
92+
end:
93+
return ret;
94+
}
95+
7996
int vnt_control_in(struct vnt_private *priv, u8 request, u16 value,
8097
u16 index, u16 length, u8 *buffer)
8198
{

drivers/staging/vt6656/usbpipe.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
#include "device.h"
2020

21+
#define VNT_REG_BLOCK_SIZE 64
22+
2123
int vnt_control_out(struct vnt_private *priv, u8 request, u16 value,
2224
u16 index, u16 length, u8 *buffer);
2325
int vnt_control_in(struct vnt_private *priv, u8 request, u16 value,
@@ -26,6 +28,9 @@ int vnt_control_in(struct vnt_private *priv, u8 request, u16 value,
2628
int vnt_control_out_u8(struct vnt_private *priv, u8 reg, u8 ref_off, u8 data);
2729
int vnt_control_in_u8(struct vnt_private *priv, u8 reg, u8 reg_off, u8 *data);
2830

31+
int vnt_control_out_blocks(struct vnt_private *priv,
32+
u16 block, u8 reg, u16 len, u8 *data);
33+
2934
int vnt_start_interrupt_urb(struct vnt_private *priv);
3035
int vnt_submit_rx_urb(struct vnt_private *priv, struct vnt_rcb *rcb);
3136
int vnt_tx_context(struct vnt_private *priv,

0 commit comments

Comments
 (0)