Commit c0ee6273 authored by Sachin Kamat's avatar Sachin Kamat Committed by Mauro Carvalho Chehab

[media] s5k5baf: Fix potential NULL pointer dereferencing

Dereference 'fw' after the NULL check.
Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 7296e158
...@@ -548,12 +548,14 @@ static void s5k5baf_synchronize(struct s5k5baf *state, int timeout, u16 addr) ...@@ -548,12 +548,14 @@ static void s5k5baf_synchronize(struct s5k5baf *state, int timeout, u16 addr)
static u16 *s5k5baf_fw_get_seq(struct s5k5baf *state, u16 seq_id) static u16 *s5k5baf_fw_get_seq(struct s5k5baf *state, u16 seq_id)
{ {
struct s5k5baf_fw *fw = state->fw; struct s5k5baf_fw *fw = state->fw;
u16 *data = fw->data + 2 * fw->count; u16 *data;
int i; int i;
if (fw == NULL) if (fw == NULL)
return NULL; return NULL;
data = fw->data + 2 * fw->count;
for (i = 0; i < fw->count; ++i) { for (i = 0; i < fw->count; ++i) {
if (fw->seq[i].id == seq_id) if (fw->seq[i].id == seq_id)
return data + fw->seq[i].offset; return data + fw->seq[i].offset;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment