summaryrefslogtreecommitdiff
path: root/fs/jfs/jfs_dtree.c
diff options
context:
space:
mode:
authorGuenter Roeck <guenter.roeck@ericsson.com>2012-04-22 20:58:51 -0700
committerGuenter Roeck <guenter.roeck@ericsson.com>2012-05-20 19:41:49 -0700
commitdbe43a62762d2a6430cf6ed65d3459ce1e8ed46c (patch)
treeec2d53d1747a522dd6bb2277ddea04ffe0f9a790 /fs/jfs/jfs_dtree.c
parent425d247680d050fe3ee7e53b9cf0240bf6b4b351 (diff)
hwmon: (ntc_thermistor) Optimize and fix build warning
The following build warning is seen in some configurations: drivers/hwmon/ntc_thermistor.c: In function 'ntc_show_temp': drivers/hwmon/ntc_thermistor.c:293: warning: 'temp' may be used uninitialized in this function Fix the problem by re-arranging the code to overload return values with error codes, and by avoiding error returns whenever possible. Specifically, Simplify lookup_comp() to not return an error. Instead, return i_low == i_high if there is an exact match, or if the ohm value is outside the lookup table range. Modify get_temp_mC() to not return an error. Since it only returns an error after lookup_comp() returned an error, this is quite straightforward after above change. Separate ntc_thermistor_read() into a function to read the resistor value (which can return an error), and the call to get_temp_mC() which doesn't. Call the functions directly from ntc_show_temp(). Code was tested using a test program, comparing the result of the old and new versions of get_temp_mC() for resistor values between 0 and 2,000,000 ohm. As a side effect, this patch reduces code size by approximately 400 bytes on x86_64. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Donggeun Kim <dg77.kim@samsung.com> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
Diffstat (limited to 'fs/jfs/jfs_dtree.c')
0 files changed, 0 insertions, 0 deletions