hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/drivers/media/usb/dvb-usb/af9005.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* DVB USB compliant Linux driver for the Afatech 9005
23 * USB1.1 DVB-T receiver.
34 *
....@@ -5,17 +6,7 @@
56 *
67 * Thanks to Afatech who kindly provided information.
78 *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * see Documentation/media/dvb-drivers/dvb-usb.rst for more information
9
+ * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information
1910 */
2011 #include "af9005.h"
2112
....@@ -431,6 +422,10 @@
431422 if (ret == 0)
432423 ret = 2;
433424 } else {
425
+ if (msg[0].len < 2) {
426
+ ret = -EOPNOTSUPP;
427
+ goto unlock;
428
+ }
434429 /* write one or more registers */
435430 reg = msg[0].buf[0];
436431 addr = msg[0].addr;
....@@ -440,6 +435,7 @@
440435 ret = 1;
441436 }
442437
438
+unlock:
443439 mutex_unlock(&d->i2c_mutex);
444440 return ret;
445441 }
....@@ -845,7 +841,7 @@
845841
846842 /* deb_info("rc_query\n"); */
847843 st->data[0] = 3; /* rest of packet length low */
848
- st->data[1] = 0; /* rest of packet lentgh high */
844
+ st->data[1] = 0; /* rest of packet length high */
849845 st->data[2] = 0x40; /* read remote */
850846 st->data[3] = 1; /* rest of packet length */
851847 st->data[4] = seq = st->sequence++; /* sequence number */
....@@ -964,8 +960,8 @@
964960 }
965961
966962 static int af9005_identify_state(struct usb_device *udev,
967
- struct dvb_usb_device_properties *props,
968
- struct dvb_usb_device_description **desc,
963
+ const struct dvb_usb_device_properties *props,
964
+ const struct dvb_usb_device_description **desc,
969965 int *cold)
970966 {
971967 int ret;