Re: [PATCH 2/3] drivers: nubus: Fix use of assignment in if condition in nubus_add_board() in nubus.c

From: Shuah Khan
Date: Wed Oct 02 2024 - 18:18:29 EST


On 10/2/24 07:28, Sayyad Abid wrote:
This change help improve code readabaility by
shifting the assignment statement just above the if statment,
which was earlier inside the condition.
This makes the code clear and easy to read.

Signed-off-by: Sayyad Abid <sayyad.abid16@xxxxxxxxx>
---
drivers/nubus/nubus.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c
index 08cf585cb471..77da1d14a1db 100644
--- a/drivers/nubus/nubus.c
+++ b/drivers/nubus/nubus.c
@@ -735,7 +735,8 @@ static void __init nubus_add_board(int slot, int bytelanes)
nubus_rewind(&rp, FORMAT_BLOCK_SIZE, bytelanes);

/* Actually we should probably panic if this fails */
- if ((board = kzalloc(sizeof(*board), GFP_ATOMIC)) == NULL)
+ board = kzalloc(sizeof(*board), GFP_ATOMIC)
+ if (board == NULL)
return;

The code is consistent with coding guidelines. There is no
need to change it.

board->fblock = rp;

--
2.39.5


thanks,
-- Shuah