Re: [PATCH] regulator: core: Add intermediate cast to uintptr_tbefore casting to pointer

From: Mark Brown
Date: Thu Aug 02 2012 - 14:00:48 EST


On Wed, Aug 01, 2012 at 12:08:08AM +0800, Axel Lin wrote:
> æ äï2012-07-31 æ 16:41 +0100ïMark Brown æåï

> > So the above cast probably isn't right... you shouldn't need a double
> > cast here.

> The issue of original warning is: ( I compile the kernel on x86_64 )
> warning: cast to pointer from integer of different size

> What this patch does is:
> cast best_val to uintptr_t, which is an unsigned integer large enough to
> hold a void* pointer.

> And then cast it to (void *).

> Thus I did (void *)(uintptr_t)best_val.

Perhaps we need a temporary variable here. The double cast just looks
too horrible.
--
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/