diff options
author | Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | 2014-07-31 13:11:02 -0400 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2014-11-02 22:02:47 -0500 |
commit | 8131a246600f0c34a71cbe1a2e4a19af7e9bc887 (patch) | |
tree | 347d611550c25e66cbe85cf9f695e4de805ad81a /drivers/thermal | |
parent | 930aa102e2b0ba70ea420999362e2edc4fda15d3 (diff) |
thermal: exynos: remove redundant threshold_code checks from exynos_tmu_initialize()
Remove runtime checks for negative return values of temp_to_code()
from exynos_tmu_initialize().
The current level temperature data hardcoded in pdata will never
cause a negative temp_to_code() return values and checking itself
is not proper. The checks in question are done at runtime in
a production code for data that is hardcoded inside driver during
development time and later it doesn't change. Such data should
be verified during development and review time (i.e. by a script
parsing relevant data from exynos_tmu_data.c, one can also argue
that verification to be done is so simple that the review by
a maintainer should be enough).
Theres should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Tested-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/samsung/exynos_tmu.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index b9bffad68334..15574ccede3d 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c | |||
@@ -215,10 +215,6 @@ static int exynos_tmu_initialize(struct platform_device *pdev) | |||
215 | if (data->soc == SOC_ARCH_EXYNOS4210) { | 215 | if (data->soc == SOC_ARCH_EXYNOS4210) { |
216 | /* Write temperature code for threshold */ | 216 | /* Write temperature code for threshold */ |
217 | threshold_code = temp_to_code(data, pdata->threshold); | 217 | threshold_code = temp_to_code(data, pdata->threshold); |
218 | if (threshold_code < 0) { | ||
219 | ret = threshold_code; | ||
220 | goto out; | ||
221 | } | ||
222 | writeb(threshold_code, | 218 | writeb(threshold_code, |
223 | data->base + reg->threshold_temp); | 219 | data->base + reg->threshold_temp); |
224 | for (i = 0; i < trigger_levs; i++) | 220 | for (i = 0; i < trigger_levs; i++) |
@@ -232,19 +228,13 @@ static int exynos_tmu_initialize(struct platform_device *pdev) | |||
232 | i < trigger_levs && i < EXYNOS_MAX_TRIGGER_PER_REG; i++) { | 228 | i < trigger_levs && i < EXYNOS_MAX_TRIGGER_PER_REG; i++) { |
233 | threshold_code = temp_to_code(data, | 229 | threshold_code = temp_to_code(data, |
234 | pdata->trigger_levels[i]); | 230 | pdata->trigger_levels[i]); |
235 | if (threshold_code < 0) { | ||
236 | ret = threshold_code; | ||
237 | goto out; | ||
238 | } | ||
239 | rising_threshold &= ~(0xff << 8 * i); | 231 | rising_threshold &= ~(0xff << 8 * i); |
240 | rising_threshold |= threshold_code << 8 * i; | 232 | rising_threshold |= threshold_code << 8 * i; |
241 | if (pdata->threshold_falling) { | 233 | if (pdata->threshold_falling) { |
242 | threshold_code = temp_to_code(data, | 234 | threshold_code = temp_to_code(data, |
243 | pdata->trigger_levels[i] - | 235 | pdata->trigger_levels[i] - |
244 | pdata->threshold_falling); | 236 | pdata->threshold_falling); |
245 | if (threshold_code > 0) | 237 | falling_threshold |= threshold_code << 8 * i; |
246 | falling_threshold |= | ||
247 | threshold_code << 8 * i; | ||
248 | } | 238 | } |
249 | } | 239 | } |
250 | 240 | ||
@@ -263,10 +253,6 @@ static int exynos_tmu_initialize(struct platform_device *pdev) | |||
263 | (pdata->trigger_type[i] == HW_TRIP)) { | 253 | (pdata->trigger_type[i] == HW_TRIP)) { |
264 | threshold_code = temp_to_code(data, | 254 | threshold_code = temp_to_code(data, |
265 | pdata->trigger_levels[i]); | 255 | pdata->trigger_levels[i]); |
266 | if (threshold_code < 0) { | ||
267 | ret = threshold_code; | ||
268 | goto out; | ||
269 | } | ||
270 | if (i == EXYNOS_MAX_TRIGGER_PER_REG - 1) { | 256 | if (i == EXYNOS_MAX_TRIGGER_PER_REG - 1) { |
271 | /* 1-4 level to be assigned in th0 reg */ | 257 | /* 1-4 level to be assigned in th0 reg */ |
272 | rising_threshold &= ~(0xff << 8 * i); | 258 | rising_threshold &= ~(0xff << 8 * i); |