forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/media/usb/dvb-usb-v2/az6007.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Driver for AzureWave 6007 DVB-C/T USB2.0 and clones
34 *
....@@ -10,15 +11,6 @@
1011 * Copyright (c) 2010-2012 Mauro Carvalho Chehab
1112 * Driver modified by in order to work with upstream drxk driver, and
1213 * 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.
2214 */
2315
2416 #include "drxk.h"
....@@ -210,7 +202,8 @@
210202 unsigned code;
211203 enum rc_proto proto;
212204
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;
214207
215208 if (st->data[1] == 0x44)
216209 return 0;
....@@ -795,6 +788,10 @@
795788 if (az6007_xfer_debug)
796789 printk(KERN_DEBUG "az6007: I2C W addr=0x%x len=%d\n",
797790 addr, msgs[i].len);
791
+ if (msgs[i].len < 1) {
792
+ ret = -EIO;
793
+ goto err;
794
+ }
798795 req = AZ6007_I2C_WR;
799796 index = msgs[i].buf[0];
800797 value = addr | (1 << 8);
....@@ -809,6 +806,10 @@
809806 if (az6007_xfer_debug)
810807 printk(KERN_DEBUG "az6007: I2C R addr=0x%x len=%d\n",
811808 addr, msgs[i].len);
809
+ if (msgs[i].len < 1) {
810
+ ret = -EIO;
811
+ goto err;
812
+ }
812813 req = AZ6007_I2C_RD;
813814 index = msgs[i].buf[0];
814815 value = addr;