forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/net/usb/cdc-phonet.c
....@@ -1,23 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * phonet.c -- USB CDC Phonet host driver
34 *
45 * Copyright (C) 2008-2009 Nokia Corporation. All rights reserved.
56 *
67 * 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
218 */
229
2310 #include <linux/kernel.h>
....@@ -49,7 +36,7 @@
4936
5037 spinlock_t rx_lock;
5138 struct sk_buff *rx_skb;
52
- struct urb *urbs[0];
39
+ struct urb *urbs[];
5340 };
5441
5542 static void tx_complete(struct urb *req);
....@@ -110,7 +97,7 @@
11097 case -ECONNRESET:
11198 case -ESHUTDOWN:
11299 dev->stats.tx_aborted_errors++;
113
- /* fall through */
100
+ fallthrough;
114101 default:
115102 dev->stats.tx_errors++;
116103 dev_dbg(&dev->dev, "TX error (%d)\n", status);
....@@ -361,8 +348,8 @@
361348 else
362349 return -EINVAL;
363350
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);
366353 if (!dev)
367354 return -ENOMEM;
368355