Commit 56baa667 authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Samuel Ortiz

mfd: fix undefined twl4030-power resconfig value checks

The code tries to skip values initialized with -1, but since the values
are unsigned the comparison is always true.

The patch eliminates the following compiler warnings:

drivers/mfd/twl4030-power.c: In function 'twl4030_configure_resource':
drivers/mfd/twl4030-power.c:338: warning: comparison is always true due to
limited range of data type
drivers/mfd/twl4030-power.c:358: warning: comparison is always true due to
limited range of data type
drivers/mfd/twl4030-power.c:363: warning: comparison is always true due to
limited range of data type
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@nokia.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent b4ead61e
...@@ -352,7 +352,7 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig) ...@@ -352,7 +352,7 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
return err; return err;
} }
if (rconfig->devgroup >= 0) { if (rconfig->devgroup != TWL4030_RESCONFIG_UNDEF) {
grp &= ~DEV_GRP_MASK; grp &= ~DEV_GRP_MASK;
grp |= rconfig->devgroup << DEV_GRP_SHIFT; grp |= rconfig->devgroup << DEV_GRP_SHIFT;
err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
...@@ -372,12 +372,12 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig) ...@@ -372,12 +372,12 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
return err; return err;
} }
if (rconfig->type >= 0) { if (rconfig->type != TWL4030_RESCONFIG_UNDEF) {
type &= ~TYPE_MASK; type &= ~TYPE_MASK;
type |= rconfig->type << TYPE_SHIFT; type |= rconfig->type << TYPE_SHIFT;
} }
if (rconfig->type2 >= 0) { if (rconfig->type2 != TWL4030_RESCONFIG_UNDEF) {
type &= ~TYPE2_MASK; type &= ~TYPE2_MASK;
type |= rconfig->type2 << TYPE2_SHIFT; type |= rconfig->type2 << TYPE2_SHIFT;
} }
......
...@@ -400,6 +400,7 @@ struct twl4030_power_data { ...@@ -400,6 +400,7 @@ struct twl4030_power_data {
struct twl4030_script **scripts; struct twl4030_script **scripts;
unsigned num; unsigned num;
struct twl4030_resconfig *resource_config; struct twl4030_resconfig *resource_config;
#define TWL4030_RESCONFIG_UNDEF ((u8)-1)
}; };
extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment