From patchwork Wed Sep 19 17:07:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 1478701 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A5ED63FE79 for ; Wed, 19 Sep 2012 17:11:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932613Ab2ISRLO (ORCPT ); Wed, 19 Sep 2012 13:11:14 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:52437 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756463Ab2ISRLM (ORCPT ); Wed, 19 Sep 2012 13:11:12 -0400 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id q8JHB8IO004171; Wed, 19 Sep 2012 12:11:08 -0500 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8JHB8oE020784; Wed, 19 Sep 2012 12:11:08 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Wed, 19 Sep 2012 12:11:08 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8JHB8io025340; Wed, 19 Sep 2012 12:11:08 -0500 Received: from localhost (h68-13.vpn.ti.com [172.24.68.13]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id q8JHB3w25463; Wed, 19 Sep 2012 12:11:03 -0500 (CDT) From: Eduardo Valentin To: CC: , , , , Radhesh Fadnis , Eduardo Valentin Subject: [PATCH 1/1] staging: omap-thermal: bandgap: fix setting of alert thresholds Date: Wed, 19 Sep 2012 20:07:49 +0300 Message-ID: <1348074469-1361-1-git-send-email-eduardo.valentin@ti.com> X-Mailer: git-send-email 1.7.7.1.488.ge8e1c MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Radhesh Fadnis There was an error in check for the valid temperature in function temp_to_adc_conversion. The temperature value was compared with higher limit for less than condition as well, resulting in returning -EINVAL. Corrected the check condition to properly check for lower and higher temperature limits. Signed-off-by: Radhesh Fadnis Signed-off-by: Eduardo Valentin --- drivers/staging/omap-thermal/omap-bandgap.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/staging/omap-thermal/omap-bandgap.c b/drivers/staging/omap-thermal/omap-bandgap.c index ff93c15..368a2e1 100644 --- a/drivers/staging/omap-thermal/omap-bandgap.c +++ b/drivers/staging/omap-thermal/omap-bandgap.c @@ -157,7 +157,7 @@ static int temp_to_adc_conversion(long temp, struct omap_bandgap *bg_ptr, int i, high = ts_data->adc_end_val - ts_data->adc_start_val; mid = (high + low) / 2; - if (temp < bg_ptr->conv_table[high] || temp > bg_ptr->conv_table[high]) + if (temp < bg_ptr->conv_table[low] || temp > bg_ptr->conv_table[high]) return -EINVAL; while (low < high) {