diff mbox

[25/50] staging: omap-thermal: rewrite omap_bandgap_mcelsius_to_adc on kernel coding style

Message ID 1363352438-15935-26-git-send-email-eduardo.valentin@ti.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Eduardo Valentin March 15, 2013, 1 p.m. UTC
Follow Documentation/CodingStyle while doing omap_bandgap_mcelsius_to_adc

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
---
 drivers/staging/omap-thermal/omap-bandgap.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

Comments

Dan Carpenter March 16, 2013, 8:33 a.m. UTC | #1
On Fri, Mar 15, 2013 at 09:00:13AM -0400, Eduardo Valentin wrote:
> Follow Documentation/CodingStyle while doing omap_bandgap_mcelsius_to_adc
> 

I have the same response for all these bunny hop patches.

When you're reading the code and you see a goto then you assume that
it's there for a reason so it's misleading when it doesn't do
anything.  It's simpler if the code is simple.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/staging/omap-thermal/omap-bandgap.c b/drivers/staging/omap-thermal/omap-bandgap.c
index d5359e3..e49a115 100644
--- a/drivers/staging/omap-thermal/omap-bandgap.c
+++ b/drivers/staging/omap-thermal/omap-bandgap.c
@@ -270,14 +270,16 @@  int omap_bandgap_mcelsius_to_adc(struct omap_bandgap *bg_ptr, int i, long temp,
 {
 	struct temp_sensor_data *ts_data = bg_ptr->conf->sensors[i].ts_data;
 	const int *conv_table = bg_ptr->conf->conv_table;
-	int high, low, mid;
+	int high, low, mid, ret = 0;
 
 	low = 0;
 	high = ts_data->adc_end_val - ts_data->adc_start_val;
 	mid = (high + low) / 2;
 
-	if (temp < conv_table[low] || temp > conv_table[high])
-		return -EINVAL;
+	if (temp < conv_table[low] || temp > conv_table[high]) {
+		ret = -ERANGE;
+		goto exit;
+	}
 
 	while (low < high) {
 		if (temp < conv_table[mid])
@@ -289,7 +291,8 @@  int omap_bandgap_mcelsius_to_adc(struct omap_bandgap *bg_ptr, int i, long temp,
 
 	*adc = ts_data->adc_start_val + low;
 
-	return 0;
+exit:
+	return ret;
 }
 
 /* Talert masks. Call it only if HAS(TALERT) is set */