media: ov2740: fix dereference before null check on pointer nvm
authorColin Ian King <colin.king@canonical.com>
Thu, 26 Nov 2020 11:49:32 +0000 (12:49 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 2 Dec 2020 15:08:58 +0000 (16:08 +0100)
commitcf10e09b9a4b28fe6df3fe8fc851fb2c4bd18a14
tree0d370da3d73f723b52747483e5364f4dfdb5758c
parent91807efbe8ec7f591085067d9f96a112e015274b
media: ov2740: fix dereference before null check on pointer nvm

Currently pointer nvm is being dereferenced before it is being null
checked.  Fix this by moving the assignments of pointers client and
ov2740 so that are after the null check hence avoiding any potential
null pointer dereferences on pointer nvm.

Fixes: 5e6fd339b68d ("media: ov2740: allow OTP data access during streaming")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/i2c/ov2740.c