Hi, Dan Thanks for your report. There is a patch from Colin King which is addressing this issue. media: ov2740: fix dereference before null check on pointer nvm Thank you! ________________________ BRs, Bingbu Cao > -----Original Message----- > From: Dan Carpenter <dan.carpenter@xxxxxxxxxx> > Sent: Wednesday, December 2, 2020 10:48 PM > To: Cao, Bingbu <bingbu.cao@xxxxxxxxx> > Cc: linux-media@xxxxxxxxxxxxxxx > Subject: [bug report] media: ov2740: allow OTP data access during > streaming > > Hello Bingbu Cao, > > This is a semi-automatic email about new static checker warnings. > > The patch 5e6fd339b68d: "media: ov2740: allow OTP data access during > streaming" from Nov 13, 2020, leads to the following Smatch complaint: > > drivers/media/i2c/ov2740.c:609 ov2740_load_otp_data() > warn: variable dereferenced before check 'nvm' (see line 603) > > drivers/media/i2c/ov2740.c > 601 static int ov2740_load_otp_data(struct nvm_data *nvm) > 602 { > 603 struct i2c_client *client = nvm->client; > ^^^^^^^^^^^ Dereference > > 604 struct ov2740 *ov2740 = > to_ov2740(i2c_get_clientdata(client)); > 605 u32 isp_ctrl00 = 0; > 606 u32 isp_ctrl01 = 0; > 607 int ret; > 608 > 609 if (!nvm) > ^^^^ > Checked too late. > > 610 return -EINVAL; > 611 > > regards, > dan carpenter