Skip to contentSkip to conversation

media: drxk: add a missed check of the return value of write16

PATCH In review Kangjie Lu 2 participants 2 messages Dec 25, 2018 – Mar 5, 2019 Media (V4L/DVB)

lore
Share & tools
lore

Kangjie Lu

author
#0 lore raw

PATCH 1/1 media: drxk: add a missed check of the return value of write16

write16() could fail. The fix inserts a check for its return value in case it fails.

---
 drivers/media/dvb-frontends/drxk_hard.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/dvb-frontends/drxk_hard.c +3 -1
index 84ac3f73f8fe..b7579ffae690 100644
@@ -6610,7 +6610,9 @@ static int drxk_get_stats(struct dvb_frontend *fe)
 	if (status < 0)
 		goto error;
 	pkt_error_count = reg16;
-	write16(state, SCU_RAM_FEC_ACCUM_PKT_FAILURES__A, 0);
+	status = write16(state, SCU_RAM_FEC_ACCUM_PKT_FAILURES__A, 0);
+	if (status < 0)
+		goto error;
 
 	post_bit_err_count *= post_bit_error_scale;
 
Signature · 1 line
2.17.2 (Apple Git-113)
#1 lore raw
Quoted 4 lines · Kangjie Lu

write16() could fail. The fix inserts a check for its return value in case it fails.

Unless it is tested on the actual hardware we can't apply this. This could introduce regressions.

Sean

Quoted 21 lines
---
 drivers/media/dvb-frontends/drxk_hard.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/dvb-frontends/drxk_hard.c +3 -1
index 84ac3f73f8fe..b7579ffae690 100644
@@ -6610,7 +6610,9 @@ static int drxk_get_stats(struct dvb_frontend *fe)
 	if (status < 0)
 		goto error;
 	pkt_error_count = reg16;
-	write16(state, SCU_RAM_FEC_ACCUM_PKT_FAILURES__A, 0);
+	status = write16(state, SCU_RAM_FEC_ACCUM_PKT_FAILURES__A, 0);
+	if (status < 0)
+		goto error;
 
 	post_bit_err_count *= post_bit_error_scale;
 
Signature · 1 line
2.17.2 (Apple Git-113)