Skip to content

Commit

Permalink
media: m5mols: Check function pointer in m5mols_sensor_power
Browse files Browse the repository at this point in the history
[ Upstream commit 52438c4 ]

clang static analysis reports this error

m5mols_core.c:767:4: warning: Called function pointer
  is null (null dereference) [core.CallAndMessage]
    info->set_power(&client->dev, 0);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In other places, the set_power ptr is checked.
So add a check.

Fixes: bc12510 ("[media] Add support for M-5MOLS 8 Mega Pixel camera ISP")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
trixirt authored and gregkh committed Oct 29, 2020
1 parent 6f398ce commit a62031b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/media/i2c/m5mols/m5mols_core.c
Expand Up @@ -764,7 +764,8 @@ static int m5mols_sensor_power(struct m5mols_info *info, bool enable)

ret = regulator_bulk_enable(ARRAY_SIZE(supplies), supplies);
if (ret) {
info->set_power(&client->dev, 0);
if (info->set_power)
info->set_power(&client->dev, 0);
return ret;
}

Expand Down

0 comments on commit a62031b

Please sign in to comment.