Dereference 'fw' after the NULL check.

Signed-off-by: Sachin Kamat <sachin.ka...@linaro.org>
---
 drivers/media/i2c/s5k5baf.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c
index 974b865c2ee1..4b8381111cbd 100644
--- a/drivers/media/i2c/s5k5baf.c
+++ b/drivers/media/i2c/s5k5baf.c
@@ -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)
 {
        struct s5k5baf_fw *fw = state->fw;
-       u16 *data = fw->data + 2 * fw->count;
+       u16 *data;
        int i;
 
        if (fw == NULL)
                return NULL;
 
+       data = fw->data + 2 * fw->count;
+
        for (i = 0; i < fw->count; ++i) {
                if (fw->seq[i].id == seq_id)
                        return data + fw->seq[i].offset;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to