[PATCH 4/4] Staging: rtl8712: osdep_intf: Improve RND4 macro for better debugging and safety

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This commit modifies the RND4_UPPER macro in the osdep_intf module of
the rtl8712 driver to improve its safety and debugging capabilities.
The macro has been changed to use a temporary variable for the input
argument 'x', instead of directly using it in the macro expression.
This change helps to avoid potential issues with operator precedence
and unexpected side effects that could occur if 'x' was reused within
the macro.

Additionally, the new definition of the macro uses the 'typeof' operator
to determine the type of the input argument, which ensures that the macro
can handle any data type safely. The new definition also uses a block
expression to contain the macro code, allowing for better debugging
capabilities and cleaner code.

This change improves the safety and maintainability of the RND4 macro
and makes it more suitable for use in the Linux kernel.

Signed-off-by: Inshal Khan <kziaul123@xxxxxxxxx>
---
 drivers/staging/rtl8712/osdep_intf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8712/osdep_intf.h b/drivers/staging/rtl8712/osdep_intf.h
index 95a21f380cd7..0e097b4a8670 100644
--- a/drivers/staging/rtl8712/osdep_intf.h
+++ b/drivers/staging/rtl8712/osdep_intf.h
@@ -18,8 +18,8 @@
 #include "drv_types.h"
 
 #define RND4(x)	({ \
-		typeof(x) _x = (x); \
-		(((_x) + 3) & ~3); \
+			typeof(x) _x = (x); \
+			(((_x) + 3) & ~3); \
 		})
 
 struct intf_priv {
-- 
2.34.1





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux