All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: b2c2: flexcop-eeprom: Fix assignment in if condition
@ 2025-07-18 12:52 Darshan Rathod
  2025-07-19  0:45 ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Darshan Rathod @ 2025-07-18 12:52 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Darshan Rathod, linux-media, linux-kernel

Function flexcop_eeprom_check_mac_addr() contains an
assignment in an 'if' condition. This coding style is not
accepted in the Linux kernel as it can conceal bugs.

Put the assignment before the 'if' condition, in an
explicit separate statement. It will also bring this code
in line with checkpatch.pl.

Also, correct a few off-by-one spaces in a function call and
variable declaration.

Signed-off-by: Darshan Rathod <darshanrathod475@gmail.com>
---
 drivers/media/common/b2c2/flexcop-eeprom.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/media/common/b2c2/flexcop-eeprom.c b/drivers/media/common/b2c2/flexcop-eeprom.c
index 0f2151cd36f2..da7c537ef93b 100644
--- a/drivers/media/common/b2c2/flexcop-eeprom.c
+++ b/drivers/media/common/b2c2/flexcop-eeprom.c
@@ -90,7 +90,7 @@ static char eeprom_set_mac_addr(struct adapter *adapter, char type, u8 *mac)
 static int flexcop_eeprom_read(struct flexcop_device *fc,
 		u16 addr, u8 *buf, u16 len)
 {
-	return fc->i2c_request(fc,FC_READ,FC_I2C_PORT_EEPROM,0x50,addr,buf,len);
+	return fc->i2c_request(fc, FC_READ, FC_I2C_PORT_EEPROM, 0x50, addr, buf, len);
 }
 
 #endif
@@ -107,7 +107,7 @@ static u8 calc_lrc(u8 *buf, int len)
 static int flexcop_eeprom_request(struct flexcop_device *fc,
 	flexcop_access_op_t op, u16 addr, u8 *buf, u16 len, int retries)
 {
-	int i,ret = 0;
+	int i, ret = 0;
 	u8 chipaddr =  0x50 | ((addr >> 8) & 3);
 	for (i = 0; i < retries; i++) {
 		ret = fc->i2c_request(&fc->fc_i2c_adap[1], op, chipaddr,
@@ -135,13 +135,15 @@ int flexcop_eeprom_check_mac_addr(struct flexcop_device *fc, int extended)
 	u8 buf[8];
 	int ret = 0;
 
-	if ((ret = flexcop_eeprom_lrc_read(fc,0x3f8,buf,8,4)) == 0) {
+	ret = flexcop_eeprom_lrc_read(fc, 0x3f8, buf, 8, 4);
+
+	if (ret == 0) {
 		if (extended != 0) {
 			err("TODO: extended (EUI64) MAC addresses aren't completely supported yet");
-			ret = -EINVAL;
-		} else
-			memcpy(fc->dvb_adapter.proposed_mac,buf,6);
-	}
-	return ret;
+			ret = ret = -EINVAL;
+		} else {
+			memcpy(fc->dvb_adapter.proposed_mac, buf, 6);
+		}
+		return ret;
 }
 EXPORT_SYMBOL(flexcop_eeprom_check_mac_addr);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-19 13:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-18 12:52 [PATCH] media: b2c2: flexcop-eeprom: Fix assignment in if condition Darshan Rathod
2025-07-19  0:45 ` kernel test robot
2025-07-19  4:42 ` kernel test robot
2025-07-19 13:50 ` Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.