| .. | .. |
|---|
| 115 | 115 | while (i < num) { |
|---|
| 116 | 116 | if (num > i + 1 && (msg[i+1].flags & I2C_M_RD)) { |
|---|
| 117 | 117 | if (msg[i].addr == ec168_ec100_config.demod_address) { |
|---|
| 118 | + if (msg[i].len < 1) { |
|---|
| 119 | + i = -EOPNOTSUPP; |
|---|
| 120 | + break; |
|---|
| 121 | + } |
|---|
| 118 | 122 | req.cmd = READ_DEMOD; |
|---|
| 119 | 123 | req.value = 0; |
|---|
| 120 | 124 | req.index = 0xff00 + msg[i].buf[0]; /* reg */ |
|---|
| .. | .. |
|---|
| 131 | 135 | } |
|---|
| 132 | 136 | } else { |
|---|
| 133 | 137 | if (msg[i].addr == ec168_ec100_config.demod_address) { |
|---|
| 138 | + if (msg[i].len < 1) { |
|---|
| 139 | + i = -EOPNOTSUPP; |
|---|
| 140 | + break; |
|---|
| 141 | + } |
|---|
| 134 | 142 | req.cmd = WRITE_DEMOD; |
|---|
| 135 | 143 | req.value = msg[i].buf[1]; /* val */ |
|---|
| 136 | 144 | req.index = 0xff00 + msg[i].buf[0]; /* reg */ |
|---|
| .. | .. |
|---|
| 139 | 147 | ret = ec168_ctrl_msg(d, &req); |
|---|
| 140 | 148 | i += 1; |
|---|
| 141 | 149 | } else { |
|---|
| 150 | + if (msg[i].len < 1) { |
|---|
| 151 | + i = -EOPNOTSUPP; |
|---|
| 152 | + break; |
|---|
| 153 | + } |
|---|
| 142 | 154 | req.cmd = WRITE_I2C; |
|---|
| 143 | 155 | req.value = msg[i].buf[0]; /* val */ |
|---|
| 144 | 156 | req.index = 0x0100 + msg[i].addr; /* I2C addr */ |
|---|