22 Jul, 2012
1 commit
-
Fix Coverity warning: Calling strncpy with a maximum size argument of 20 bytes
on destination array "data->name" of size 20 bytes might leave the destination
string unterminated.Fix by replacing strncpy() with strlcpy() and by using sizeof() to determine
the maximum string length.Signed-off-by: Guenter Roeck
Acked-by: Jean Delvare
21 May, 2012
4 commits
-
Fix checkpatch WARNING: quoted string split across lines
Signed-off-by: Guenter Roeck
Reviewed-by: Robert Coulson -
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 functionFix 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
Cc: Donggeun Kim
Reviewed-by: Robert Coulson -
hwmon_device_register() never returns a NULL pointer in case of errors, but
an error value. Use it.Signed-off-by: Guenter Roeck
Reviewed-by: Robert Coulson -
This avoids memory leaks, and makes the code a bit simpler and smaller.
Signed-off-by: Guenter Roeck
Reviewed-by: Robert Coulson
27 Nov, 2011
1 commit
-
This patch converts the drivers in drivers/hwmon/* to use the
module_platform_driver() macro which makes the code smaller and a bit
simpler.Cc: Donggeun Kim
Cc: Simon Guinot
Cc: Lars-Peter Clausen
Cc: MyungJoo Ham
Cc: Ben Dooks
Cc: Hans de Goede
Cc: J Keerthy
Cc: David S. Miller
Cc: Mark Brown
Signed-off-by: Axel Lin
Acked-by: Mark Brown
Signed-off-by: Guenter Roeck
23 Aug, 2011
1 commit
-
Replace unnecessary if with else statement.
This fixes the following (false) compile warning reported with some combinations
of C compiler version and configuration.drivers/hwmon/ntc_thermistor.c: In function 'ntc_show_temp':
drivers/hwmon/ntc_thermistor.c:225: warning: 'low' may be used uninitialized in
this function
drivers/hwmon/ntc_thermistor.c:225: note: 'low' was declared here
drivers/hwmon/ntc_thermistor.c:225: warning: 'high' may be used uninitialized in
this function
drivers/hwmon/ntc_thermistor.c:225: note: 'high' was declared here
drivers/hwmon/ntc_thermistor.c:294: warning: 'temp' may be used uninitialized in
this functionSigned-off-by: Guenter Roeck
Acked-by: Jean Delvare
28 Jul, 2011
1 commit
-
Add support for NTC Thermistor series. In this release, the
following thermistors are supported: NCP15WB473, NCP18WB473, NCP03WB473,
and NCP15WL333. This driver is based on the datasheet of MURATA.The driver in the patch does conversion from the raw ADC value
(either voltage or resistence) to temperature. In order to use
voltage values as input, the circuit schematics should be provided
with the platform data. A compensation table for each type of thermistor
is provided for the conversion.Signed-off-by: Donggeun Kim
Signed-off-by: MyungJoo Ham
Signed-off-by: KyungMin Park
Reviewed-by: Shubhrajyoti D
Signed-off-by: Guenter Roeck