| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * phonet.c -- USB CDC Phonet host driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2008-2009 Nokia Corporation. All rights reserved. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Rémi Denis-Courmont |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or |
|---|
| 9 | | - * modify it under the terms of the GNU General Public License |
|---|
| 10 | | - * version 2 as published by the Free Software Foundation. |
|---|
| 11 | | - * |
|---|
| 12 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 13 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 15 | | - * General Public License for more details. |
|---|
| 16 | | - * |
|---|
| 17 | | - * You should have received a copy of the GNU General Public License |
|---|
| 18 | | - * along with this program; if not, write to the Free Software |
|---|
| 19 | | - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
|---|
| 20 | | - * 02110-1301 USA |
|---|
| 21 | 8 | */ |
|---|
| 22 | 9 | |
|---|
| 23 | 10 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 49 | 36 | |
|---|
| 50 | 37 | spinlock_t rx_lock; |
|---|
| 51 | 38 | struct sk_buff *rx_skb; |
|---|
| 52 | | - struct urb *urbs[0]; |
|---|
| 39 | + struct urb *urbs[]; |
|---|
| 53 | 40 | }; |
|---|
| 54 | 41 | |
|---|
| 55 | 42 | static void tx_complete(struct urb *req); |
|---|
| .. | .. |
|---|
| 110 | 97 | case -ECONNRESET: |
|---|
| 111 | 98 | case -ESHUTDOWN: |
|---|
| 112 | 99 | dev->stats.tx_aborted_errors++; |
|---|
| 113 | | - /* fall through */ |
|---|
| 100 | + fallthrough; |
|---|
| 114 | 101 | default: |
|---|
| 115 | 102 | dev->stats.tx_errors++; |
|---|
| 116 | 103 | dev_dbg(&dev->dev, "TX error (%d)\n", status); |
|---|
| .. | .. |
|---|
| 361 | 348 | else |
|---|
| 362 | 349 | return -EINVAL; |
|---|
| 363 | 350 | |
|---|
| 364 | | - dev = alloc_netdev(sizeof(*pnd) + sizeof(pnd->urbs[0]) * rxq_size, |
|---|
| 365 | | - ifname, NET_NAME_UNKNOWN, usbpn_setup); |
|---|
| 351 | + dev = alloc_netdev(struct_size(pnd, urbs, rxq_size), ifname, |
|---|
| 352 | + NET_NAME_UNKNOWN, usbpn_setup); |
|---|
| 366 | 353 | if (!dev) |
|---|
| 367 | 354 | return -ENOMEM; |
|---|
| 368 | 355 | |
|---|