| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* DVB USB compliant Linux driver for the Afatech 9005 |
|---|
| 2 | 3 | * USB1.1 DVB-T receiver. |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Thanks to Afatech who kindly provided information. |
|---|
| 7 | 8 | * |
|---|
| 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 |
|---|
| 19 | 10 | */ |
|---|
| 20 | 11 | #include "af9005.h" |
|---|
| 21 | 12 | |
|---|
| .. | .. |
|---|
| 431 | 422 | if (ret == 0) |
|---|
| 432 | 423 | ret = 2; |
|---|
| 433 | 424 | } else { |
|---|
| 425 | + if (msg[0].len < 2) { |
|---|
| 426 | + ret = -EOPNOTSUPP; |
|---|
| 427 | + goto unlock; |
|---|
| 428 | + } |
|---|
| 434 | 429 | /* write one or more registers */ |
|---|
| 435 | 430 | reg = msg[0].buf[0]; |
|---|
| 436 | 431 | addr = msg[0].addr; |
|---|
| .. | .. |
|---|
| 440 | 435 | ret = 1; |
|---|
| 441 | 436 | } |
|---|
| 442 | 437 | |
|---|
| 438 | +unlock: |
|---|
| 443 | 439 | mutex_unlock(&d->i2c_mutex); |
|---|
| 444 | 440 | return ret; |
|---|
| 445 | 441 | } |
|---|
| .. | .. |
|---|
| 845 | 841 | |
|---|
| 846 | 842 | /* deb_info("rc_query\n"); */ |
|---|
| 847 | 843 | 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 */ |
|---|
| 849 | 845 | st->data[2] = 0x40; /* read remote */ |
|---|
| 850 | 846 | st->data[3] = 1; /* rest of packet length */ |
|---|
| 851 | 847 | st->data[4] = seq = st->sequence++; /* sequence number */ |
|---|
| .. | .. |
|---|
| 964 | 960 | } |
|---|
| 965 | 961 | |
|---|
| 966 | 962 | 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, |
|---|
| 969 | 965 | int *cold) |
|---|
| 970 | 966 | { |
|---|
| 971 | 967 | int ret; |
|---|