diff options
Diffstat (limited to 'drivers/media/dvb-frontends/dib9000.c')
-rw-r--r-- | drivers/media/dvb-frontends/dib9000.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/media/dvb-frontends/dib9000.c b/drivers/media/dvb-frontends/dib9000.c index e540cfb13bac..f75dec443783 100644 --- a/drivers/media/dvb-frontends/dib9000.c +++ b/drivers/media/dvb-frontends/dib9000.c | |||
@@ -1040,13 +1040,18 @@ static int dib9000_risc_apb_access_write(struct dib9000_state *state, u32 addres | |||
1040 | if (address >= 1024 || !state->platform.risc.fw_is_running) | 1040 | if (address >= 1024 || !state->platform.risc.fw_is_running) |
1041 | return -EINVAL; | 1041 | return -EINVAL; |
1042 | 1042 | ||
1043 | if (len > 18) | ||
1044 | return -EINVAL; | ||
1045 | |||
1043 | /* dprintk( "APB access thru wr fw %d %x", address, attribute); */ | 1046 | /* dprintk( "APB access thru wr fw %d %x", address, attribute); */ |
1044 | 1047 | ||
1045 | mb[0] = (unsigned short)address; | 1048 | mb[0] = (u16)address; |
1046 | for (i = 0; i < len && i < 20; i += 2) | 1049 | for (i = 0; i + 1 < len; i += 2) |
1047 | mb[1 + (i / 2)] = (b[i] << 8 | b[i + 1]); | 1050 | mb[1 + i / 2] = b[i] << 8 | b[i + 1]; |
1051 | if (len & 1) | ||
1052 | mb[1 + len / 2] = b[len - 1] << 8; | ||
1048 | 1053 | ||
1049 | dib9000_mbx_send_attr(state, OUT_MSG_BRIDGE_APB_W, mb, 1 + len / 2, attribute); | 1054 | dib9000_mbx_send_attr(state, OUT_MSG_BRIDGE_APB_W, mb, (3 + len) / 2, attribute); |
1050 | return dib9000_mbx_get_message_attr(state, IN_MSG_END_BRIDGE_APB_RW, mb, &s, attribute) == 1 ? 0 : -EINVAL; | 1055 | return dib9000_mbx_get_message_attr(state, IN_MSG_END_BRIDGE_APB_RW, mb, &s, attribute) == 1 ? 0 : -EINVAL; |
1051 | } | 1056 | } |
1052 | 1057 | ||