| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Driver for AzureWave 6007 DVB-C/T USB2.0 and clones |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 10 | 11 | * Copyright (c) 2010-2012 Mauro Carvalho Chehab |
|---|
| 11 | 12 | * Driver modified by in order to work with upstream drxk driver, and |
|---|
| 12 | 13 | * tons of bugs got fixed, and converted to use dvb-usb-v2. |
|---|
| 13 | | - * |
|---|
| 14 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 15 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 16 | | - * the Free Software Foundation under version 2 of the License. |
|---|
| 17 | | - * |
|---|
| 18 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 19 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 20 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 21 | | - * GNU General Public License for more details. |
|---|
| 22 | 14 | */ |
|---|
| 23 | 15 | |
|---|
| 24 | 16 | #include "drxk.h" |
|---|
| .. | .. |
|---|
| 210 | 202 | unsigned code; |
|---|
| 211 | 203 | enum rc_proto proto; |
|---|
| 212 | 204 | |
|---|
| 213 | | - az6007_read(d, AZ6007_READ_IR, 0, 0, st->data, 10); |
|---|
| 205 | + if (az6007_read(d, AZ6007_READ_IR, 0, 0, st->data, 10) < 0) |
|---|
| 206 | + return -EIO; |
|---|
| 214 | 207 | |
|---|
| 215 | 208 | if (st->data[1] == 0x44) |
|---|
| 216 | 209 | return 0; |
|---|
| .. | .. |
|---|
| 795 | 788 | if (az6007_xfer_debug) |
|---|
| 796 | 789 | printk(KERN_DEBUG "az6007: I2C W addr=0x%x len=%d\n", |
|---|
| 797 | 790 | addr, msgs[i].len); |
|---|
| 791 | + if (msgs[i].len < 1) { |
|---|
| 792 | + ret = -EIO; |
|---|
| 793 | + goto err; |
|---|
| 794 | + } |
|---|
| 798 | 795 | req = AZ6007_I2C_WR; |
|---|
| 799 | 796 | index = msgs[i].buf[0]; |
|---|
| 800 | 797 | value = addr | (1 << 8); |
|---|
| .. | .. |
|---|
| 809 | 806 | if (az6007_xfer_debug) |
|---|
| 810 | 807 | printk(KERN_DEBUG "az6007: I2C R addr=0x%x len=%d\n", |
|---|
| 811 | 808 | addr, msgs[i].len); |
|---|
| 809 | + if (msgs[i].len < 1) { |
|---|
| 810 | + ret = -EIO; |
|---|
| 811 | + goto err; |
|---|
| 812 | + } |
|---|
| 812 | 813 | req = AZ6007_I2C_RD; |
|---|
| 813 | 814 | index = msgs[i].buf[0]; |
|---|
| 814 | 815 | value = addr; |
|---|