Commit 17a70355 authored by Rob Herring's avatar Rob Herring

of: fix sparse warnings in fdt, irq, reserved mem, and resolver code

sparse generates the following warnings in drivers/of/:

../drivers/of/fdt.c:63:36: warning: cast to restricted __be32
../drivers/of/fdt.c:68:33: warning: cast to restricted __be32
../drivers/of/irq.c:105:88: warning: incorrect type in initializer (different base types)
../drivers/of/irq.c:105:88:    expected restricted __be32
../drivers/of/irq.c:105:88:    got int
../drivers/of/irq.c:526:35: warning: incorrect type in assignment (different modifiers)
../drivers/of/irq.c:526:35:    expected int ( *const [usertype] irq_init_cb )( ... )
../drivers/of/irq.c:526:35:    got void const *const data
../drivers/of/of_reserved_mem.c:200:50: warning: incorrect type in initializer (different modifiers)
../drivers/of/of_reserved_mem.c:200:50:    expected int ( *[usertype] initfn )( ... )
../drivers/of/of_reserved_mem.c:200:50:    got void const *const data
../drivers/of/resolver.c:95:42: warning: incorrect type in assignment (different base types)
../drivers/of/resolver.c:95:42:    expected unsigned int [unsigned] [usertype] <noident>
../drivers/of/resolver.c:95:42:    got restricted __be32 [usertype] <noident>

All these are harmless type mismatches fixed by adjusting the types.
Signed-off-by: default avatarRob Herring <robh@kernel.org>
parent eb310036
...@@ -48,8 +48,8 @@ void of_fdt_limit_memory(int limit) ...@@ -48,8 +48,8 @@ void of_fdt_limit_memory(int limit)
const void *val; const void *val;
int nr_address_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT; int nr_address_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT;
int nr_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT; int nr_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT;
const uint32_t *addr_prop; const __be32 *addr_prop;
const uint32_t *size_prop; const __be32 *size_prop;
int root_offset; int root_offset;
int cell_size; int cell_size;
......
...@@ -102,7 +102,7 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) ...@@ -102,7 +102,7 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
__be32 initial_match_array[MAX_PHANDLE_ARGS]; __be32 initial_match_array[MAX_PHANDLE_ARGS];
const __be32 *match_array = initial_match_array; const __be32 *match_array = initial_match_array;
const __be32 *tmp, *imap, *imask, dummy_imask[] = { [0 ... MAX_PHANDLE_ARGS] = ~0 }; const __be32 *tmp, *imap, *imask, dummy_imask[] = { [0 ... MAX_PHANDLE_ARGS] = cpu_to_be32(~0) };
u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0;
int imaplen, match, i, rc = -EINVAL; int imaplen, match, i, rc = -EINVAL;
......
...@@ -197,7 +197,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem) ...@@ -197,7 +197,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
const struct of_device_id *i; const struct of_device_id *i;
for (i = __reservedmem_of_table; i < &__rmem_of_table_sentinel; i++) { for (i = __reservedmem_of_table; i < &__rmem_of_table_sentinel; i++) {
reservedmem_of_init_fn initfn = i->data; int const (*initfn)(struct reserved_mem *rmem) = i->data;
const char *compat = i->compatible; const char *compat = i->compatible;
if (!of_flat_dt_is_compatible(rmem->fdt_node, compat)) if (!of_flat_dt_is_compatible(rmem->fdt_node, compat))
......
...@@ -92,7 +92,7 @@ static void adjust_overlay_phandles(struct device_node *overlay, ...@@ -92,7 +92,7 @@ static void adjust_overlay_phandles(struct device_node *overlay,
if (phandle == OF_PHANDLE_ILLEGAL) if (phandle == OF_PHANDLE_ILLEGAL)
continue; continue;
*(uint32_t *)prop->value = cpu_to_be32(overlay->phandle); *(__be32 *)prop->value = cpu_to_be32(overlay->phandle);
} }
for_each_child_of_node(overlay, child) for_each_child_of_node(overlay, child)
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/of.h> #include <linux/of.h>
typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *); typedef int const (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
/* /*
* Workarounds only applied to 32bit powermac machines * Workarounds only applied to 32bit powermac machines
......
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