sound/i2c: Simplify the return expression of snd_i2c_bit_sendbyte()
PATCH 1/1 sound/i2c: Simplify the return expression of snd_i2c_bit_sendbyte()
From: Zhichao Cai <[email protected]>
Simplify the return expression.
Signed-off-by Zhichao Cai <[email protected]>
--- sound/i2c/i2c.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/i2c/i2c.c +1 -3
@@ -235,9 +235,7 @@ static int snd_i2c_bit_sendbyte(struct snd_i2c_bus *bus, unsigned char data)for (i =7 ; i >=0 ; i--)snd_i2c_bit_send (bus, !!(data & (1 << i))); err =snd_i2c_bit_ack (bus); -if (err <0 ) -return err; -return 0 ; +return err <0 ? err :0 ; }static int snd_i2c_bit_readbyte (struct snd_i2c_bus *bus,int last)
Signature · 1 line
1.9.1
Quoted 14 lines · caizhichao
From: Zhichao Cai <[email protected]>
Simplify the return expression.
Signed-off-by Zhichao Cai <[email protected]>--- sound/i2c/i2c.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)sound/i2c/i2c.c +0
-0
sound/i2c/i2c.c static int snd_i2c_bit_sendbyte(struct snd_i2c_bus *bus, unsigned char data) · line 238
Quoted 7 lines
sound/i2c/i2c.c +1
-3@@ -235,9 +235,7 @@ static int snd_i2c_bit_sendbyte(struct snd_i2c_bus *bus, unsigned char data)for (i =7 ; i >=0 ; i--)snd_i2c_bit_send (bus, !!(data & (1 << i))); err =snd_i2c_bit_ack (bus); -if (err <0 ) -return err; -return 0 ; +return err <0 ? err :0 ;
This isn't a simplification, you're just making the code harder to read for no good reason.
sound/i2c/i2c.c static int snd_i2c_bit_sendbyte(struct snd_i2c_bus *bus, unsigned char data) · line 241
Quoted 3 lines
sound/i2c/i2c.c +0
-0}static int snd_i2c_bit_readbyte (struct snd_i2c_bus *bus,int last)
Johan