[PATCH 0/9] Fix some style problems in net

Zhang Han posted 9 patches 3 years, 4 months ago
Test checkpatch failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20201222082340.67405-1-zhanghan64@huawei.com
Maintainers: Dmitry Fleytman <dmitry.fleytman@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, Samuel Thibault <samuel.thibault@ens-lyon.org>, Stefan Weil <sw@weilnetz.de>, Jason Wang <jasowang@redhat.com>
net/checksum.c    |  11 +-
net/eth.c         |   2 +-
net/net.c         |  26 +++--
net/queue.c       |   5 +-
net/slirp.c       |   8 +-
net/socket.c      |  32 +++---
net/tap-bsd.c     |   6 +-
net/tap-linux.c   |  20 ++--
net/tap-linux.h   |  10 +-
net/tap-solaris.c |  76 ++++++++------
net/tap-win32.c   | 258 +++++++++++++++++++++++++---------------------
net/vde.c         |   4 +-
net/vhost-user.c  |   2 +-
13 files changed, 259 insertions(+), 201 deletions(-)
[PATCH 0/9] Fix some style problems in net
Posted by Zhang Han 3 years, 4 months ago
Some style problems in net directory are found by checkpatch.pl. Fix these
style problems.

Zhang Han (9):
  net: Add spaces around operator/delete redundant spaces
  net: Add braces for statements/fix braces' position
  net: transfer // comments to /**/
  net: transfer "foo* bar" to "foo *"
  net: fix lines over 90 characters
  net: Transfer tabs to spcaes
  net: remove assignment in if condition
  net: Remove initialization of static ints
  net: Fix the indent problems

 net/checksum.c    |  11 +-
 net/eth.c         |   2 +-
 net/net.c         |  26 +++--
 net/queue.c       |   5 +-
 net/slirp.c       |   8 +-
 net/socket.c      |  32 +++---
 net/tap-bsd.c     |   6 +-
 net/tap-linux.c   |  20 ++--
 net/tap-linux.h   |  10 +-
 net/tap-solaris.c |  76 ++++++++------
 net/tap-win32.c   | 258 +++++++++++++++++++++++++---------------------
 net/vde.c         |   4 +-
 net/vhost-user.c  |   2 +-
 13 files changed, 259 insertions(+), 201 deletions(-)

-- 
2.29.1.59.gf9b6481aed


Re: [PATCH 0/9] Fix some style problems in net
Posted by no-reply@patchew.org 3 years, 4 months ago
Patchew URL: https://patchew.org/QEMU/20201222082340.67405-1-zhanghan64@huawei.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20201222082340.67405-1-zhanghan64@huawei.com
Subject: [PATCH 0/9] Fix some style problems in net

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 - [tag update]      patchew/20201221134931.1194806-1-david.edmondson@oracle.com -> patchew/20201221134931.1194806-1-david.edmondson@oracle.com
 * [new tag]         patchew/20201222082340.67405-1-zhanghan64@huawei.com -> patchew/20201222082340.67405-1-zhanghan64@huawei.com
Switched to a new branch 'test'
a1e8031 net: Fix the indent problems
3a9a235 net: Remove initialization of static ints
e1c36e1 net: Remove assignment in if condition
55fc567 net: Transfer tabs to spcaes
c96ec8e net: Fix lines over 90 characters
a9b2502 net: Transfer "foo* " to "foo *"
9dd5b80 net: Transfer // comments to /**/
cb5a663 net: Add braces for statements/fix braces' position
3256d58 net: Add spaces around operator/delete redundant spaces

=== OUTPUT BEGIN ===
1/9 Checking commit 3256d589d47c (net: Add spaces around operator/delete redundant spaces)
ERROR: braces {} are necessary for all arms of this statement
#24: FILE: net/checksum.c:44:
+    while (sum >> 16)
[...]

ERROR: suspect code indent for conditional statements (4, 7)
#128: FILE: net/tap-solaris.c:78:
+    if (*dev) {
        ptr = dev;

ERROR: trailing statements should be on next line
#131: FILE: net/tap-solaris.c:80:
+       while (*ptr && !qemu_isdigit((int)*ptr)) ptr++;

ERROR: braces {} are necessary for all arms of this statement
#131: FILE: net/tap-solaris.c:80:
+       while (*ptr && !qemu_isdigit((int)*ptr)) ptr++;
[...]

ERROR: suspect code indent for conditional statements (4, 7)
#137: FILE: net/tap-solaris.c:85:
+    if (ip_fd)
        close(ip_fd);

ERROR: braces {} are necessary for all arms of this statement
#137: FILE: net/tap-solaris.c:85:
+    if (ip_fd)
[...]

ERROR: do not use assignment in if condition
#146: FILE: net/tap-solaris.c:105:
+    if ((ppa = ioctl(tap_fd, I_STR, &strioc_ppa)) < 0)

ERROR: braces {} are necessary for all arms of this statement
#146: FILE: net/tap-solaris.c:105:
+    if ((ppa = ioctl(tap_fd, I_STR, &strioc_ppa)) < 0)
[...]

ERROR: braces {} are necessary for all arms of this statement
#171: FILE: net/tap-solaris.c:127:
+    if (ioctl(if_fd, SIOCSLIFNAME, &ifr) < 0)
[...]

ERROR: braces {} are necessary for all arms of this statement
#174: FILE: net/tap-solaris.c:129:
+    if (ioctl(if_fd, SIOCGLIFFLAGS, &ifr) < 0)
[...]

ERROR: braces {} are necessary for all arms of this statement
#178: FILE: net/tap-solaris.c:132:
+    if (ioctl(if_fd, I_PUSH, "arp") < 0)
[...]

ERROR: braces {} are necessary for all arms of this statement
#183: FILE: net/tap-solaris.c:136:
+    if (ioctl(ip_fd, I_POP, NULL) < 0)
[...]

ERROR: braces {} are necessary for all arms of this statement
#186: FILE: net/tap-solaris.c:138:
+    if (ioctl(ip_fd, I_PUSH, "arp") < 0)
[...]

ERROR: do not use assignment in if condition
#204: FILE: net/tap-solaris.c:154:
+    if ((ip_muxid = ioctl(ip_fd, I_LINK, if_fd)) < 0) {

ERROR: do not use assignment in if condition
#210: FILE: net/tap-solaris.c:159:
+    if ((arp_muxid = ioctl(ip_fd, link_type, arp_fd)) < 0)

ERROR: braces {} are necessary for all arms of this statement
#210: FILE: net/tap-solaris.c:159:
+    if ((arp_muxid = ioctl(ip_fd, link_type, arp_fd)) < 0)
[...]

ERROR: suspect code indent for conditional statements (4, 6)
#222: FILE: net/tap-solaris.c:169:
+    if (ioctl(ip_fd, SIOCSLIFMUXID, &ifr) < 0)
     {

ERROR: line over 90 characters
#297: FILE: net/tap-win32.c:174:
+static tun_buffer_t* get_buffer_from_output_queue_immediate(tap_win32_overlapped_t* const overlapped)

ERROR: "foo* bar" should be "foo *bar"
#297: FILE: net/tap-win32.c:174:
+static tun_buffer_t* get_buffer_from_output_queue_immediate(tap_win32_overlapped_t* const overlapped)

WARNING: line over 80 characters
#306: FILE: net/tap-win32.c:183:
+    if (overlapped->output_queue_front == NULL && overlapped->output_queue_back == NULL) {

ERROR: braces {} are necessary for all arms of this statement
#416: FILE: net/tap-win32.c:458:
+    if (!overlapped->tap_semaphore)
[...]

WARNING: line over 80 characters
#425: FILE: net/tap-win32.c:470:
+    result = GetOverlappedResult(overlapped->handle, &overlapped->write_overlapped,

WARNING: line over 80 characters
#434: FILE: net/tap-win32.c:503:
+        FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,

ERROR: line over 90 characters
#443: FILE: net/tap-win32.c:534:
+                result = GetOverlappedResult(overlapped->handle, &overlapped->read_overlapped,

ERROR: line over 90 characters
#450: FILE: net/tap-win32.c:540:
+                    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,

WARNING: line over 80 characters
#463: FILE: net/tap-win32.c:550:
+                FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,

total: 22 errors, 4 warnings, 457 lines checked

Patch 1/9 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

2/9 Checking commit cb5a6632624a (net: Add braces for statements/fix braces' position)
ERROR: suspect code indent for conditional statements (7, 11)
#251: FILE: net/tap-solaris.c:80:
+       while (*ptr && !qemu_isdigit((int)*ptr)) {
+           ptr++;

ERROR: suspect code indent for conditional statements (4, 7)
#259: FILE: net/tap-solaris.c:87:
+    if (ip_fd) {
        close(ip_fd);

ERROR: do not use assignment in if condition
#270: FILE: net/tap-solaris.c:108:
+    if ((ppa = ioctl(tap_fd, I_STR, &strioc_ppa)) < 0) {

ERROR: do not use assignment in if condition
#328: FILE: net/tap-solaris.c:170:
+    if ((arp_muxid = ioctl(ip_fd, link_type, arp_fd)) < 0) {

ERROR: suspect code indent for conditional statements (4, 6)
#340: FILE: net/tap-solaris.c:181:
+    if (ioctl(ip_fd, SIOCSLIFMUXID, &ifr) < 0) {
       ioctl(ip_fd, I_PUNLINK , arp_muxid);

total: 5 errors, 0 warnings, 381 lines checked

Patch 2/9 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

3/9 Checking commit 9dd5b80ec06d (net: Transfer // comments to /**/)
4/9 Checking commit a9b2502fcb92 (net: Transfer "foo* " to "foo *")
WARNING: line over 80 characters
#56: FILE: net/tap-win32.c:126:
+static tun_buffer_t *get_buffer_from_free_list(tap_win32_overlapped_t *const overlapped)

ERROR: line over 90 characters
#68: FILE: net/tap-win32.c:139:
+static void put_buffer_on_free_list(tap_win32_overlapped_t *const overlapped, tun_buffer_t *const buffer)

ERROR: line over 90 characters
#77: FILE: net/tap-win32.c:148:
+static tun_buffer_t *get_buffer_from_output_queue(tap_win32_overlapped_t *const overlapped, const int block)

ERROR: line over 90 characters
#89: FILE: net/tap-win32.c:180:
+static tun_buffer_t *get_buffer_from_output_queue_immediate(tap_win32_overlapped_t *const overlapped)

ERROR: line over 90 characters
#95: FILE: net/tap-win32.c:185:
+static void put_buffer_on_output_queue(tap_win32_overlapped_t *const overlapped, tun_buffer_t *const buffer)

ERROR: line over 90 characters
#104: FILE: net/tap-win32.c:412:
+static void tap_win32_overlapped_init(tap_win32_overlapped_t *const overlapped, const HANDLE handle)

total: 5 errors, 1 warnings, 115 lines checked

Patch 4/9 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

5/9 Checking commit c96ec8e7f974 (net: Fix lines over 90 characters)
WARNING: Block comments use a leading /* on a separate line
#34: FILE: net/socket.c:358:
+    /* fd passed: multicast: "learn" dgram_dst address from bound address

ERROR: line over 90 characters
#74: FILE: net/tap-win32.c:151:
+static tun_buffer_t *get_buffer_from_output_queue(tap_win32_overlapped_t *const overlapped,

WARNING: line over 80 characters
#139: FILE: net/tap-win32.c:560:
+                    fprintf(stderr, "Tap-Win32: Error GetOverlappedResult %d - %s\n",

total: 1 errors, 2 warnings, 123 lines checked

Patch 5/9 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

6/9 Checking commit 55fc567376cd (net: Transfer tabs to spcaes)
7/9 Checking commit e1c36e115c99 (net: Remove assignment in if condition)
8/9 Checking commit 3a9a235f5e6f (net: Remove initialization of static ints)
9/9 Checking commit a1e8031d967e (net: Fix the indent problems)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20201222082340.67405-1-zhanghan64@huawei.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Re: [PATCH 0/9] Fix some style problems in net
Posted by zhanghan (J) 3 years, 3 months ago
ping?

This patch set is submmitted a month ago, and have received no replies.
Did I miss any replies?

The link follows:
http://patchwork.ozlabs.org/project/qemu-devel/cover/20201222082340.67405-1-zhanghan64@huawei.com/

Re: [PATCH 0/9] Fix some style problems in net
Posted by zhanghan (J) 3 years, 3 months ago
ping?This patch set about code style problem in net receives no replies.

Did I miss any response?

The link follows:
http://patchwork.ozlabs.org/project/qemu-devel/cover/20201222082340.67405-1-zhanghan64@huawei.com/