[PATCH 1/4] uImage: cleanup some warnings

Andrew Jones drjones at redhat.com
Wed Nov 25 09:32:24 PST 2015


On Tue, Nov 24, 2015 at 04:00:26PM +0900, Simon Horman wrote:
> I don't see any value in masking warnings with casts.

I assume you mean that you would prefer to either change the callers' type
or uImage's API in order to avoid the need for casts. Choosing to keep
warnings wouldn't make sense; they add noise making it difficult to spot
warnings that point out real problems, and you can't ever turn on -Werror.

In this case I think casts are the right solution. We shouldn't change the
uImage API, as unsigned char is the type generally used for an arbitrary
data stream. The callers could possibly be changed, but they're also free
to use whatever type they want, signed char may well be what they want.
Indeed, the fact that each caller (architecture) has its own wrapper
around the uImage API calls allows for this very thing. Furthermore, an
explicit cast acknowledges that the two types were both chosen by design.
If this patch is wrong, then the warning has done its job and we need to
change the callers.

Thanks,
drew



More information about the kexec mailing list