hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/media/radio/si470x/radio-si470x-usb.c
....@@ -1,19 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * drivers/media/radio/si470x/radio-si470x-usb.c
34 *
45 * USB driver for radios with Silicon Labs Si470x FM Radio Receivers
56 *
67 * Copyright (c) 2009 Tobias Lorenz <tobias.lorenz@gmx.net>
7
- *
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.
178 */
189
1910
....@@ -519,13 +510,10 @@
519510 {
520511 struct si470x_device *radio = video_drvdata(file);
521512
522
- strlcpy(capability->driver, DRIVER_NAME, sizeof(capability->driver));
523
- strlcpy(capability->card, DRIVER_CARD, sizeof(capability->card));
513
+ strscpy(capability->driver, DRIVER_NAME, sizeof(capability->driver));
514
+ strscpy(capability->card, DRIVER_CARD, sizeof(capability->card));
524515 usb_make_path(radio->usbdev, capability->bus_info,
525516 sizeof(capability->bus_info));
526
- capability->device_caps = V4L2_CAP_HW_FREQ_SEEK | V4L2_CAP_READWRITE |
527
- V4L2_CAP_TUNER | V4L2_CAP_RADIO | V4L2_CAP_RDS_CAPTURE;
528
- capability->capabilities = capability->device_caps | V4L2_CAP_DEVICE_CAPS;
529517 return 0;
530518 }
531519
....@@ -679,6 +667,9 @@
679667 radio->videodev.lock = &radio->lock;
680668 radio->videodev.v4l2_dev = &radio->v4l2_dev;
681669 radio->videodev.release = video_device_release_empty;
670
+ radio->videodev.device_caps =
671
+ V4L2_CAP_HW_FREQ_SEEK | V4L2_CAP_READWRITE | V4L2_CAP_TUNER |
672
+ V4L2_CAP_RADIO | V4L2_CAP_RDS_CAPTURE;
682673 video_set_drvdata(&radio->videodev, radio);
683674
684675 /* get device and chip versions */
....@@ -742,8 +733,10 @@
742733
743734 /* start radio */
744735 retval = si470x_start_usb(radio);
745
- if (retval < 0)
736
+ if (retval < 0 && !radio->int_in_running)
746737 goto err_buf;
738
+ else if (retval < 0) /* in case of radio->int_in_running == 1 */
739
+ goto err_all;
747740
748741 /* set initial frequency */
749742 si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */