const void *fdt_offset_ptr(const void *fdt, int offset, int checklen);
 static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
 {
-       return (void *)fdt_offset_ptr(fdt, offset, checklen);
+       return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen);
 }
 
 uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
                                                      const char *name,
                                                      int *lenp)
 {
-       return (struct fdt_property *)fdt_get_property(fdt, nodeoffset,
-                                                      name, lenp);
+       return (struct fdt_property *)(uintptr_t)
+               fdt_get_property(fdt, nodeoffset, name, lenp);
 }
 
 /**
 static inline void *fdt_getprop_w(void *fdt, int nodeoffset,
                                  const char *name, int *lenp)
 {
-       return (void *)fdt_getprop(fdt, nodeoffset, name, lenp);
+       return (void *)(uintptr_t)fdt_getprop(fdt, nodeoffset, name, lenp);
 }
 
 /**
 
 
 const char *fdt_string(const void *fdt, int stroffset)
 {
-       return (char *)fdt + fdt_off_dt_strings(fdt) + stroffset;
+       return (const char *)fdt + fdt_off_dt_strings(fdt) + stroffset;
 }
 
 int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size)
 
 
        RW_CHECK_HEADER(fdt);
 
-       namep = (char *)fdt_get_name(fdt, nodeoffset, &oldlen);
+       namep = (char *)(uintptr_t)fdt_get_name(fdt, nodeoffset, &oldlen);
        if (!namep)
                return oldlen;
 
        /* But if that overlaps with the old tree... */
        if (((tmp + newsize) > fdtstart) && (tmp < fdtend)) {
                /* Try right after the old tree instead */
-               tmp = (char *)fdtend;
+               tmp = (char *)(uintptr_t)fdtend;
                if ((tmp + newsize) > ((char *)buf + bufsize))
                        return -FDT_ERR_NOSPACE;
        }
 
 
 static inline void *_fdt_offset_ptr_w(void *fdt, int offset)
 {
-       return (void *)_fdt_offset_ptr(fdt, offset);
+       return (void *)(uintptr_t)_fdt_offset_ptr(fdt, offset);
 }
 
 static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, int n)
 {
-       const struct fdt_reserve_entry *rsv_table = (struct fdt_reserve_entry *)
+       const struct fdt_reserve_entry *rsv_table =
+               (const struct fdt_reserve_entry *)
                ((const char *)fdt + fdt_off_mem_rsvmap(fdt));
 
        return rsv_table + n;
 }
 static inline struct fdt_reserve_entry *_fdt_mem_rsv_w(void *fdt, int n)
 {
-       return (void *)_fdt_mem_rsv(fdt, n);
+       return (void *)(uintptr_t)_fdt_mem_rsv(fdt, n);
 }
 
 #define SW_MAGIC               (~FDT_MAGIC)