* [PATCH v2] media: b2c2: flexcop-eeprom: Fix assignment and missing return in MAC check
@ 2025-07-18 14:51 Darshan Rathod
2025-07-20 10:48 ` Markus Elfring
0 siblings, 1 reply; 3+ messages in thread
From: Darshan Rathod @ 2025-07-18 14:51 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Darshan Rathod, linux-media, linux-kernel
Fixes a coding style violation and build error in
`flexcop_eeprom_check_mac_addr()`. The function contained
an invalid assignment in an if-condition and was missing
a return at the end of a non-void function.
Fixes the warning:
warning: operation on ‘ret’ may be undefined [-Wsequence-point]
And the error:
error: control reaches end of non-void function [-Werror=return-type]
Signed-off-by: Darshan Rathod <darshanrathod475@gmail.com>
---
drivers/media/common/b2c2/flexcop-eeprom.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/media/common/b2c2/flexcop-eeprom.c b/drivers/media/common/b2c2/flexcop-eeprom.c
index 0f2151cd36f2..c4f66d13941e 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,12 +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);
+ ret = ret = -EINVAL;
+ } else {
+ memcpy(fc->dvb_adapter.proposed_mac, buf, 6);
+ }
}
return ret;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] media: b2c2: flexcop-eeprom: Fix assignment and missing return in MAC check
2025-07-18 14:51 [PATCH v2] media: b2c2: flexcop-eeprom: Fix assignment and missing return in MAC check Darshan Rathod
@ 2025-07-20 10:48 ` Markus Elfring
2025-07-21 5:20 ` Darshan Rathod
0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2025-07-20 10:48 UTC (permalink / raw)
To: Darshan Rathod, linux-media; +Cc: LKML, Mauro Carvalho Chehab
> Fixes a coding style violation and build error in
> `flexcop_eeprom_check_mac_addr()`.
Will it be more desirable to separate some adjustments?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.16-rc6#n81
> The function contained
> an invalid assignment in an if-condition and was missing
> a return at the end of a non-void function.
I find this information inappropriate.
…
> ---
> drivers/media/common/b2c2/flexcop-eeprom.c | 15 +++++++++------
…
How do you think about to improve your version management?
https://lore.kernel.org/all/?q=%22This+looks+like+a+new+version+of+a+previously+submitted+patch%22
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.16-rc6#n784
…
> @@ -135,12 +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) {
Would you like to use the following code variant?
int ret = flexcop_eeprom_lrc_read(fc, 0x3f8, buf, 8, 4);
…
> + ret = ret = -EINVAL;
…
Why do you present a duplicate assignment for this variable?
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] media: b2c2: flexcop-eeprom: Fix assignment and missing return in MAC check
2025-07-20 10:48 ` Markus Elfring
@ 2025-07-21 5:20 ` Darshan Rathod
0 siblings, 0 replies; 3+ messages in thread
From: Darshan Rathod @ 2025-07-21 5:20 UTC (permalink / raw)
To: Markus Elfring; +Cc: linux-media, LKML, Mauro Carvalho Chehab
Hello,
Please disregard this patch. I would like to formally withdraw this patch
Sorry for the noise.
Thanks,
Darshan Rathod
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-21 5:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-18 14:51 [PATCH v2] media: b2c2: flexcop-eeprom: Fix assignment and missing return in MAC check Darshan Rathod
2025-07-20 10:48 ` Markus Elfring
2025-07-21 5:20 ` Darshan Rathod
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).