.. | .. |
---|
282 | 282 | { |
---|
283 | 283 | struct shark_device *shark; |
---|
284 | 284 | int retval = -ENOMEM; |
---|
| 285 | + static const u8 ep_addresses[] = { |
---|
| 286 | + SHARK_IN_EP | USB_DIR_IN, |
---|
| 287 | + SHARK_OUT_EP | USB_DIR_OUT, |
---|
| 288 | + 0}; |
---|
| 289 | + |
---|
| 290 | + /* Are the expected endpoints present? */ |
---|
| 291 | + if (!usb_check_int_endpoints(intf, ep_addresses)) { |
---|
| 292 | + dev_err(&intf->dev, "Invalid radioSHARK2 device\n"); |
---|
| 293 | + return -EINVAL; |
---|
| 294 | + } |
---|
285 | 295 | |
---|
286 | 296 | shark = kzalloc(sizeof(struct shark_device), GFP_KERNEL); |
---|
287 | 297 | if (!shark) |
---|
.. | .. |
---|
310 | 320 | shark->tea.ops = &shark_tea_ops; |
---|
311 | 321 | shark->tea.has_am = true; |
---|
312 | 322 | shark->tea.write_before_read = true; |
---|
313 | | - strlcpy(shark->tea.card, "Griffin radioSHARK2", |
---|
| 323 | + strscpy(shark->tea.card, "Griffin radioSHARK2", |
---|
314 | 324 | sizeof(shark->tea.card)); |
---|
315 | 325 | usb_make_path(shark->usbdev, shark->tea.bus_info, |
---|
316 | 326 | sizeof(shark->tea.bus_info)); |
---|