Skip to content

Commit

Permalink
msm: camera: Fix null pointer exception in regulator disable
Browse files Browse the repository at this point in the history
Adding a NULL check before disable regulator to make sure
that its not released before.

Change-Id: I21ff1649db3e00588f1c320418fca270bc0264bc
Signed-off-by: Vijay kumar Tumati <vtumati@codeaurora.org>
  • Loading branch information
Vijay kumar Tumati authored and Gerrit - the friendly Code Review server committed Aug 28, 2017
1 parent 90076db commit fbecafa
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions drivers/media/platform/msm/camera_v2/common/msm_camera_io_util.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2011-2014, The Linux Foundataion. All rights reserved.
/* Copyright (c) 2011-2014, 2017, The Linux Foundataion. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
Expand Down Expand Up @@ -556,12 +556,16 @@ int msm_camera_enable_vreg(struct device *dev, struct camera_vreg_t *cam_vreg,
continue;
} else
j = i;
regulator_disable(reg_ptr[j]);
if (cam_vreg[j].delay > 20)
msleep(cam_vreg[j].delay);
else if (cam_vreg[j].delay)
usleep_range(cam_vreg[j].delay * 1000,
(cam_vreg[j].delay * 1000) + 1000);
if (reg_ptr[j]) {
regulator_disable(reg_ptr[j]);
if (cam_vreg[j].delay > 20)
msleep(cam_vreg[j].delay);
else if (cam_vreg[j].delay)
usleep_range(
cam_vreg[j].delay * 1000,
(cam_vreg[j].delay * 1000)
+ 1000);
}
}
}
return rc;
Expand Down

0 comments on commit fbecafa

Please sign in to comment.