lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20231211021821.110467-1-shaojijie@huawei.com>
Date:   Mon, 11 Dec 2023 10:18:21 +0800
From:   Jijie Shao <shaojijie@...wei.com>
To:     <mkubecek@...e.cz>
CC:     <shenjian15@...wei.com>, <wangjie125@...wei.com>,
        <liuyonglong@...wei.com>, <shaojijie@...wei.com>,
        <lanhao@...wei.com>, <netdev@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: [PATCH ethtool] net: ethtool: Add default branch to sff8636_show_all_ioctl switch

From: Hao Lan <lanhao@...wei.com>

The current sff8636_show_all_ioctl code uses a switch statement
to determine the module type, and exits directly with a return statement
when a match is found. However, when the module type cannot be matched,
the sff8636_memory_map_init_buf and sff8636_show_all_common functions
are executed. This writing style is not intuitive enough.
Therefore, this patch adding a default branch in the switch statement
to improve the readability of the code.

Signed-off-by: Hao Lan <lanhao@...wei.com>
Signed-off-by: Jijie Shao <shaojijie@...wei.com>
---
 qsfp.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/qsfp.c b/qsfp.c
index eedf688..a2921fb 100644
--- a/qsfp.c
+++ b/qsfp.c
@@ -985,11 +985,12 @@ void sff8636_show_all_ioctl(const __u8 *id, __u32 eeprom_len)
 	case SFF8024_ID_SFP_DD_CMIS:
 	case SFF8024_ID_SFP_PLUS_CMIS:
 		cmis_show_all_ioctl(id);
-		return;
+		break;
+	default:
+		sff8636_memory_map_init_buf(&map, id, eeprom_len);
+		sff8636_show_all_common(&map);
+		break;
 	}
-
-	sff8636_memory_map_init_buf(&map, id, eeprom_len);
-	sff8636_show_all_common(&map);
 }
 
 static void sff8636_request_init(struct ethtool_module_eeprom *request, u8 page,
-- 
2.30.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ