Skip to content

Commit 529c657

Browse files
ribaldamchehab
authored andcommitted
media: dvb-frontends: drx39xyj: Use min macro
Replace ternary assignments with min() to simplify and make the code more readable. Found by cocci: drivers/media/dvb-frontends/drx39xyj/drxj.c:1447:23-24: WARNING opportunity for min() drivers/media/dvb-frontends/drx39xyj/drxj.c:1662:21-22: WARNING opportunity for min() drivers/media/dvb-frontends/drx39xyj/drxj.c:1685:24-25: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/[email protected] Reviewed-by: Bryan O'Donoghue <[email protected]> Signed-off-by: Ricardo Ribalda <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 2998b97 commit 529c657

File tree

1 file changed

+3
-6
lines changed
  • drivers/media/dvb-frontends/drx39xyj

1 file changed

+3
-6
lines changed

drivers/media/dvb-frontends/drx39xyj/drxj.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,8 +1445,7 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr,
14451445

14461446
/* Read block from I2C **************************************************** */
14471447
do {
1448-
u16 todo = (datasize < DRXDAP_MAX_RCHUNKSIZE ?
1449-
datasize : DRXDAP_MAX_RCHUNKSIZE);
1448+
u16 todo = min(datasize, DRXDAP_MAX_RCHUNKSIZE);
14501449

14511450
bufx = 0;
14521451

@@ -1660,7 +1659,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr,
16601659
Address must be rewritten because HI is reset after data transport and
16611660
expects an address.
16621661
*/
1663-
todo = (block_size < datasize ? block_size : datasize);
1662+
todo = min(block_size, datasize);
16641663
if (todo == 0) {
16651664
u16 overhead_size_i2c_addr = 0;
16661665
u16 data_block_size = 0;
@@ -1682,9 +1681,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr,
16821681
first_err = st;
16831682
}
16841683
bufx = 0;
1685-
todo =
1686-
(data_block_size <
1687-
datasize ? data_block_size : datasize);
1684+
todo = min(data_block_size, datasize);
16881685
}
16891686
memcpy(&buf[bufx], data, todo);
16901687
/* write (address if can do and) data */

0 commit comments

Comments
 (0)