Re: [PATCH] mfd: fix more undefined twl4030-power resconfig valuechecks
From: Samuel Ortiz
Date: Wed Oct 21 2009 - 18:25:23 EST
On Wed, Oct 21, 2009 at 02:49:22PM +0300, Amit Kucheria wrote:
> Based on Aaro's previous fix, this needs to be fixed for the newly added
> remap_off and remap_sleep resources as well.
>
> 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
Thanks Amit, patch applied.
Cheers,
Samuel.
> Signed-off-by: Amit Kucheria <amit.kucheria@xxxxxxxxxxxxx>
> Cc: Samuel Ortiz <sameo@xxxxxxxxxxxxxxx>
> ---
> drivers/mfd/twl4030-power.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
> index 9f98c36..3048f18 100644
> --- a/drivers/mfd/twl4030-power.c
> +++ b/drivers/mfd/twl4030-power.c
> @@ -398,12 +398,12 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
> return err;
> }
>
> - if (rconfig->remap_off >= 0) {
> + if (rconfig->remap_off != TWL4030_RESCONFIG_UNDEF) {
> remap &= ~OFF_STATE_MASK;
> remap |= rconfig->remap_off << OFF_STATE_SHIFT;
> }
>
> - if (rconfig->remap_sleep >= 0) {
> + if (rconfig->remap_sleep != TWL4030_RESCONFIG_UNDEF) {
> remap &= ~SLEEP_STATE_MASK;
> remap |= rconfig->remap_off << SLEEP_STATE_SHIFT;
> }
> --
> 1.6.3.3
>
--
Intel Open Source Technology Centre
http://oss.intel.com/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/