Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1527458
| From | Caesar Wang <wxt@rock-chips.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/5] thermal: rockchip: fixes invalid temperature case |
| Date | 2016-11-22 13:40 +0100 |
| Message-ID | <sGiwF-79h-3@gated-at.bofh.it> (permalink) |
| References | <sGiwF-79h-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The temp_to_code function will return 0 when we set the trip points value
or valid temperature.
This patch will prevent this case happening.
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
---
drivers/thermal/rockchip_thermal.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index 766486f..535f1fa 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -401,17 +401,15 @@ static u32 rk_tsadcv2_temp_to_code(const struct chip_tsadc_table *table,
int temp)
{
int high, low, mid;
- u32 error = 0;
+ u32 error = table->data_mask;
low = 0;
high = table->length - 1;
mid = (high + low) / 2;
/* Return mask code data when the temp is over table range */
- if (temp < table->id[low].temp || temp > table->id[high].temp) {
- error = table->data_mask;
+ if (temp < table->id[low].temp || temp > table->id[high].temp)
goto exit;
- }
while (low <= high) {
if (temp == table->id[mid].temp)
--
2.7.4
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 3/5] thermal: rockchip: fixes invalid temperature case Caesar Wang <wxt@rock-chips.com> - 2016-11-22 13:40 +0100
Re: [PATCH 3/5] thermal: rockchip: fixes invalid temperature case Brian Norris <briannorris@chromium.org> - 2016-11-22 22:00 +0100
Re: [PATCH 3/5] thermal: rockchip: fixes invalid temperature case Brian Norris <briannorris@chromium.org> - 2016-11-22 23:00 +0100
Re: [PATCH 3/5] thermal: rockchip: fixes invalid temperature case Caesar Wang <wxt@rock-chips.com> - 2016-11-23 03:10 +0100
Re: [PATCH 3/5] thermal: rockchip: fixes invalid temperature case Brian Norris <briannorris@chromium.org> - 2016-11-23 03:40 +0100
Re: [PATCH 3/5] thermal: rockchip: fixes invalid temperature case Caesar Wang <wxt@rock-chips.com> - 2016-11-23 04:10 +0100
Re: [PATCH 3/5] thermal: rockchip: fixes invalid temperature case Brian Norris <briannorris@chromium.org> - 2016-11-23 05:40 +0100
csiph-web