lkml.org 
[lkml]   [2018]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] media: drx: fix a missing check of return value
Date
Function drxj_dap_write_reg16(), which writes data to buffer, may fail.
We need to check if it fails, and if so, we should goto error.
Otherwise, the buffer will have incorrect data.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/media/dvb-frontends/drx39xyj/drxj.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c
index 551b7d65fa66..d105125bc1c3 100644
--- a/drivers/media/dvb-frontends/drx39xyj/drxj.c
+++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c
@@ -2136,9 +2136,13 @@ int drxj_dap_atomic_read_write_block(struct i2c_device_addr *dev_addr,

word = ((u16) data[2 * i]);
word += (((u16) data[(2 * i) + 1]) << 8);
- drxj_dap_write_reg16(dev_addr,
+ rc = drxj_dap_write_reg16(dev_addr,
(DRXJ_HI_ATOMIC_BUF_START + i),
word, 0);
+ if (rc) {
+ pr_err("error %d\n", rc);
+ goto rw_error;
+ }
}
}

--
2.17.2 (Apple Git-113)
\
 
 \ /
  Last update: 2018-12-20 07:59    [W:0.068 / U:8.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site