Thread (3 messages) flat view 3 messages, 2 authors, 2021-11-22
STALE1727d

[PATCH] drivers/net/ethernet/sfc/: Simplify code

From: Alejandro Colomar <hidden>
Date: 2021-11-20 20:15:36
Subsystem: networking drivers, sfc network driver, the rest · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Edward Cree, Linus Torvalds

That ternary operator has
the same exact code in both of the branches.

Unless there's some hidden magic in the condition,
there's no reason for it to be,
and it can be replaced
by the code in one of the branches.

That code has been untouched since it was added,
so there's no information in git about
why it was written that way.

Signed-off-by: Alejandro Colomar <redacted>
Cc: Edward Cree <ecree.xilinx@gmail.com>
Cc: Martin Habets <redacted>
Cc: netdev@vger.kernel.org
---
 drivers/net/ethernet/sfc/ethtool_common.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/sfc/ethtool_common.c b/drivers/net/ethernet/sfc/ethtool_common.c
index bd552c7dffcb..1b9e8b0afb3c 100644
--- a/drivers/net/ethernet/sfc/ethtool_common.c
+++ b/drivers/net/ethernet/sfc/ethtool_common.c
@@ -33,10 +33,7 @@ struct efx_sw_stat_desc {
 				get_stat_function) {			\
 	.name = #stat_name,						\
 	.source = EFX_ETHTOOL_STAT_SOURCE_##source_name,		\
-	.offset = ((((field_type *) 0) ==				\
-		      &((struct efx_##source_name *)0)->field) ?	\
-		    offsetof(struct efx_##source_name, field) :		\
-		    offsetof(struct efx_##source_name, field)),		\
+	.offset = offsetof(struct efx_##source_name, field),		\
 	.get_stat = get_stat_function,					\
 }
 
-- 
2.33.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help