Staging: iio: adc: Replace memset with eth_broadcast_addr
Subsystems (4)
PATCH 1/1 Staging: iio: adc: Replace memset with eth_broadcast_addr
Use eth_broadcast_addr to assign the broadcast address to the given address array instead of memset when the second argument is a broacast address 0xff. ETH_ALEN is a macro with value 6, so 6 is treated as ETH_ALEN if it is the third argument of memset.
Done using coccinelle.
@@
expression e;
@@
- memset(e,\(0xff\|0xFF\|255\),\(ETH_ALEN\|6\));
+ eth_broadcast_addr(e);
--- drivers/staging/iio/adc/ad7192.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/adc/ad7192.c +1 -1
@@ -225,7 +225,7 @@ static int ad7192_setup(struct ad7192_state *st,u8 ones[6 ];/* reset the serial interface */ -memset (&ones,0xFF ,6 ); +eth_broadcast_addr (&ones); ret =spi_write (st->sd.spi, &ones,6 );if (ret <0 ) goto out;
Signature · 1 line
1.9.1
Greg KH
maintainerQuoted 22 lines · Bhumika Goyal
Use
eth_broadcast_addrto assign the broadcast address to the given address array instead of memset when the second argument is a broacast address0xff.ETH_ALENis a macro with value 6, so 6 is treated asETH_ALENif it is the third argument of memset.Done using coccinelle.
@@
expression e;
@@
- memset(e,\(0xff\|0xFF\|255\),\(ETH_ALEN\|6\));
+eth_broadcast_addr(e);Signed-off-by Bhumika Goyal <[email protected]>--- drivers/staging/iio/adc/ad7192.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/iio/adc/ad7192.c +0
-0
drivers/staging/iio/adc/ad7192.c static int ad7192_setup(struct ad7192_state *st, · line 231
Quoted 8 lines
drivers/staging/iio/adc/ad7192.c +1
-1@@ -225,7 +225,7 @@ static int ad7192_setup(struct ad7192_state *st,u8 ones[6 ];/* reset the serial interface */ -memset (&ones,0xFF ,6 ); +eth_broadcast_addr (&ones); ret =spi_write (st->sd.spi, &ones,6 );if (ret <0 ) goto out;
You didn't test build this change :(