.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2005-2006 Micronas USA Inc. |
---|
3 | | - * |
---|
4 | | - * This program is free software; you can redistribute it and/or modify |
---|
5 | | - * it under the terms of the GNU General Public License (Version 2) as |
---|
6 | | - * published by the Free Software Foundation. |
---|
7 | | - * |
---|
8 | | - * This program is distributed in the hope that it will be useful, |
---|
9 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
10 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
11 | | - * GNU General Public License for more details. |
---|
12 | 4 | */ |
---|
13 | 5 | |
---|
14 | 6 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
---|
.. | .. |
---|
1133 | 1125 | usb->usbdev = usbdev; |
---|
1134 | 1126 | usb_make_path(usbdev, go->bus_info, sizeof(go->bus_info)); |
---|
1135 | 1127 | go->board_id = id->driver_info; |
---|
1136 | | - strncpy(go->name, name, sizeof(go->name)); |
---|
| 1128 | + strscpy(go->name, name, sizeof(go->name)); |
---|
1137 | 1129 | if (board->flags & GO7007_USB_EZUSB) |
---|
1138 | 1130 | go->hpi_ops = &go7007_usb_ezusb_hpi_ops; |
---|
1139 | 1131 | else |
---|
1140 | 1132 | go->hpi_ops = &go7007_usb_onboard_hpi_ops; |
---|
1141 | 1133 | go->hpi_context = usb; |
---|
| 1134 | + |
---|
| 1135 | + ep = usb->usbdev->ep_in[4]; |
---|
| 1136 | + if (!ep) |
---|
| 1137 | + goto allocfail; |
---|
1142 | 1138 | |
---|
1143 | 1139 | /* Allocate the URB and buffer for receiving incoming interrupts */ |
---|
1144 | 1140 | usb->intr_urb = usb_alloc_urb(0, GFP_KERNEL); |
---|
.. | .. |
---|
1149 | 1145 | if (usb->intr_urb->transfer_buffer == NULL) |
---|
1150 | 1146 | goto allocfail; |
---|
1151 | 1147 | |
---|
1152 | | - ep = usb->usbdev->ep_in[4]; |
---|
1153 | 1148 | if (usb_endpoint_type(&ep->desc) == USB_ENDPOINT_XFER_BULK) |
---|
1154 | 1149 | usb_fill_bulk_urb(usb->intr_urb, usb->usbdev, |
---|
1155 | 1150 | usb_rcvbulkpipe(usb->usbdev, 4), |
---|
.. | .. |
---|
1200 | 1195 | go->board_id = GO7007_BOARDID_ENDURA; |
---|
1201 | 1196 | usb->board = board = &board_endura; |
---|
1202 | 1197 | go->board_info = &board->main_info; |
---|
1203 | | - strncpy(go->name, "Pelco Endura", |
---|
| 1198 | + strscpy(go->name, "Pelco Endura", |
---|
1204 | 1199 | sizeof(go->name)); |
---|
1205 | 1200 | } else { |
---|
1206 | 1201 | u16 channel; |
---|
.. | .. |
---|
1234 | 1229 | case 1: |
---|
1235 | 1230 | go->tuner_type = TUNER_SONY_BTF_PG472Z; |
---|
1236 | 1231 | go->std = V4L2_STD_PAL; |
---|
1237 | | - strncpy(go->name, "Plextor PX-TV402U-EU", |
---|
1238 | | - sizeof(go->name)); |
---|
| 1232 | + strscpy(go->name, "Plextor PX-TV402U-EU", |
---|
| 1233 | + sizeof(go->name)); |
---|
1239 | 1234 | break; |
---|
1240 | 1235 | case 2: |
---|
1241 | 1236 | go->tuner_type = TUNER_SONY_BTF_PK467Z; |
---|
1242 | 1237 | go->std = V4L2_STD_NTSC_M_JP; |
---|
1243 | 1238 | num_i2c_devs -= 2; |
---|
1244 | | - strncpy(go->name, "Plextor PX-TV402U-JP", |
---|
1245 | | - sizeof(go->name)); |
---|
| 1239 | + strscpy(go->name, "Plextor PX-TV402U-JP", |
---|
| 1240 | + sizeof(go->name)); |
---|
1246 | 1241 | break; |
---|
1247 | 1242 | case 3: |
---|
1248 | 1243 | go->tuner_type = TUNER_SONY_BTF_PB463Z; |
---|
1249 | 1244 | num_i2c_devs -= 2; |
---|
1250 | | - strncpy(go->name, "Plextor PX-TV402U-NA", |
---|
1251 | | - sizeof(go->name)); |
---|
| 1245 | + strscpy(go->name, "Plextor PX-TV402U-NA", |
---|
| 1246 | + sizeof(go->name)); |
---|
1252 | 1247 | break; |
---|
1253 | 1248 | default: |
---|
1254 | 1249 | pr_debug("unable to detect tuner type!\n"); |
---|
.. | .. |
---|
1271 | 1266 | |
---|
1272 | 1267 | /* Allocate the URBs and buffers for receiving the video stream */ |
---|
1273 | 1268 | if (board->flags & GO7007_USB_EZUSB) { |
---|
| 1269 | + if (!usb->usbdev->ep_in[6]) |
---|
| 1270 | + goto allocfail; |
---|
1274 | 1271 | v_urb_len = 1024; |
---|
1275 | 1272 | video_pipe = usb_rcvbulkpipe(usb->usbdev, 6); |
---|
1276 | 1273 | } else { |
---|
| 1274 | + if (!usb->usbdev->ep_in[1]) |
---|
| 1275 | + goto allocfail; |
---|
1277 | 1276 | v_urb_len = 512; |
---|
1278 | 1277 | video_pipe = usb_rcvbulkpipe(usb->usbdev, 1); |
---|
1279 | 1278 | } |
---|
.. | .. |
---|
1293 | 1292 | /* Allocate the URBs and buffers for receiving the audio stream */ |
---|
1294 | 1293 | if ((board->flags & GO7007_USB_EZUSB) && |
---|
1295 | 1294 | (board->main_info.flags & GO7007_BOARD_HAS_AUDIO)) { |
---|
| 1295 | + if (!usb->usbdev->ep_in[8]) |
---|
| 1296 | + goto allocfail; |
---|
1296 | 1297 | for (i = 0; i < 8; ++i) { |
---|
1297 | 1298 | usb->audio_urbs[i] = usb_alloc_urb(0, GFP_KERNEL); |
---|
1298 | 1299 | if (usb->audio_urbs[i] == NULL) |
---|