[PATCH] platform/x86: dell_rbu: fix assignment in if condition

darshanrathod475@gmail.com posted 1 patch 2 months ago
drivers/platform/x86/dell/dell_rbu.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
[PATCH] platform/x86: dell_rbu: fix assignment in if condition
Posted by darshanrathod475@gmail.com 2 months ago
From: Darshan Rathod <darshanrathod475@gmail.com>

Refactor to remove assignments from inside if conditions, as required
by kernel coding style. This improves code readability and resolves
checkpatch.pl warnings:

    ERROR: do not use assignment in if condition

Signed-off-by: Darshan Rathod <darshanrathod475@gmail.com>
---
 drivers/platform/x86/dell/dell_rbu.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/dell/dell_rbu.c b/drivers/platform/x86/dell/dell_rbu.c
index 2a140d1c656a..403df9bd9522 100644
--- a/drivers/platform/x86/dell/dell_rbu.c
+++ b/drivers/platform/x86/dell/dell_rbu.c
@@ -232,7 +232,8 @@ static int packetize_data(const u8 *data, size_t length)
 			done = 1;
 		}
 
-		if ((rc = create_packet(temp, packet_length)))
+		rc = create_packet(temp, packet_length);
+		if (rc)
 			return rc;
 
 		pr_debug("%p:%td\n", temp, (end - temp));
@@ -276,7 +277,7 @@ static int do_packet_read(char *data, struct packet_data *newpacket,
 	return bytes_copied;
 }
 
-static int packet_read_list(char *data, size_t * pread_length)
+static int packet_read_list(char *data, size_t *pread_length)
 {
 	struct packet_data *newpacket;
 	int temp_count = 0;
@@ -445,7 +446,8 @@ static ssize_t read_packet_data(char *buffer, loff_t pos, size_t count)
 	bytes_left = rbu_data.imagesize - pos;
 	data_length = min(bytes_left, count);
 
-	if ((retval = packet_read_list(ptempBuf, &data_length)) < 0)
+	retval = packet_read_list(ptempBuf, &data_length);
+	if (retval < 0)
 		goto read_rbu_data_exit;
 
 	if ((pos + count) > rbu_data.imagesize) {
-- 
2.25.1
Re: [PATCH] platform/x86: dell_rbu: fix assignment in if condition
Posted by Ilpo Järvinen 1 month, 3 weeks ago
On Fri, 01 Aug 2025 16:17:05 +0530, darshanrathod475@gmail.com wrote:

> Refactor to remove assignments from inside if conditions, as required
> by kernel coding style. This improves code readability and resolves
> checkpatch.pl warnings:
> 
>     ERROR: do not use assignment in if condition
> 
> 
> [...]


Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/1] platform/x86: dell_rbu: fix assignment in if condition
      commit: 1ccc2e20fe1d3b91395de8ca9ce0efe070287534

--
 i.