crypto: ice: Fix NULL pointer exception in ice.

While enabling ICE setup and on error conditions, the regulator
is disabled. Before disabling the regulator, check if the
regulator is up and able to access the registers of regulator.

Change-Id: I94dd2b3e25444818f7bdf2f791f4fa9efaefce15
Signed-off-by: Brahmaji K <bkomma@codeaurora.org>
This commit is contained in:
Brahmaji K 2016-10-24 20:28:18 +05:30
parent af883d4db0
commit fb77e96735

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2017, The Linux Foundation. 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
@ -1608,7 +1608,18 @@ static int enable_ice_setup(struct ice_device *ice_dev)
out_clocks:
qcom_ice_enable_clocks(ice_dev, false);
out_reg:
regulator_disable(ice_dev->reg);
if (ice_dev->is_regulator_available) {
if (qcom_ice_get_vreg(ice_dev)) {
pr_err("%s: Could not get regulator\n", __func__);
goto out;
}
ret = regulator_disable(ice_dev->reg);
if (ret) {
pr_err("%s:%pK: Could not disable regulator\n",
__func__, ice_dev);
goto out;
}
}
out:
return ret;
}