Skip to content

Commit

Permalink
media: ov2740: Use traditional pattern when checking error codes
Browse files Browse the repository at this point in the history
Instead of 'if (!ret)' switch to "check for the error first" rule.

Signed-off-by: Andy Shevchenko <[email protected]>
Signed-off-by: Sakari Ailus <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
andy-shev authored and mchehab committed Nov 25, 2022
1 parent 6919695 commit e645289
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions drivers/media/i2c/ov2740.c
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,6 @@ static int ov2740_register_nvmem(struct i2c_client *client,
struct nvmem_config nvmem_config = { };
struct regmap *regmap;
struct device *dev = &client->dev;
int ret;

nvm = devm_kzalloc(dev, sizeof(*nvm), GFP_KERNEL);
if (!nvm)
Expand Down Expand Up @@ -1122,12 +1121,11 @@ static int ov2740_register_nvmem(struct i2c_client *client,
nvmem_config.size = CUSTOMER_USE_OTP_SIZE;

nvm->nvmem = devm_nvmem_register(dev, &nvmem_config);
if (IS_ERR(nvm->nvmem))
return PTR_ERR(nvm->nvmem);

ret = PTR_ERR_OR_ZERO(nvm->nvmem);
if (!ret)
ov2740->nvm = nvm;

return ret;
ov2740->nvm = nvm;
return 0;
}

static int ov2740_probe(struct i2c_client *client)
Expand Down

0 comments on commit e645289

Please sign in to comment.