summaryrefslogtreecommitdiff
path: root/backport-net-ethtool-Add-default-branch-to-sff8636_show_all_i.patch
diff options
context:
space:
mode:
Diffstat (limited to 'backport-net-ethtool-Add-default-branch-to-sff8636_show_all_i.patch')
-rw-r--r--backport-net-ethtool-Add-default-branch-to-sff8636_show_all_i.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/backport-net-ethtool-Add-default-branch-to-sff8636_show_all_i.patch b/backport-net-ethtool-Add-default-branch-to-sff8636_show_all_i.patch
new file mode 100644
index 0000000..bc4076f
--- /dev/null
+++ b/backport-net-ethtool-Add-default-branch-to-sff8636_show_all_i.patch
@@ -0,0 +1,43 @@
+From 6bb620009e2e4aeaa41313247a0a5668abf393df Mon Sep 17 00:00:00 2001
+From: Hao Lan <lanhao@huawei.com>
+Date: Mon, 11 Dec 2023 10:18:21 +0800
+Subject: net: ethtool: Add default branch to sff8636_show_all_ioctl switch
+
+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@huawei.com>
+Signed-off-by: Jijie Shao <shaojijie@huawei.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,
+--
+cgit 1.2.3-korg
+