Browse Source

MA-10031 [Android]fix compile warning for android

There are some warning on 64-bit platform,like:
drivers/usb/gadget/bcb.c:151:29: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]
sprintf(addr_str, "0x%x", (unsigned int)p_block);

fix through cast point to uintptr_t firstly.

declare in header to fix below warning:
drivers/usb/gadget/f_fastboot.c:971:5: warning: implicit declaration of
function 'fastboot_tx_write_str' [-Wimplicit-function-declaration]
fastboot_tx_write_str("FAILinvalid mmc device");

Change-Id: Ifc9a2adbea4fe4a510fd06030396181b2513fbbe
Signed-off-by: zhang sanshan <sanshan.zhang@nxp.com>
zhang sanshan 3 years ago
parent
commit
04a1c2adc7
5 changed files with 23 additions and 11 deletions
  1. +2
    -2
      drivers/usb/gadget/bcb.c
  2. +1
    -1
      drivers/usb/gadget/bcb.h
  3. +8
    -8
      drivers/usb/gadget/f_fastboot.c
  4. +4
    -0
      include/fsl_fastboot.h
  5. +8
    -0
      include/part.h

+ 2
- 2
drivers/usb/gadget/bcb.c View File

@ -148,7 +148,7 @@ int bcb_rw_block(bool bread, char **ppblock,
(int)(blk_size * block_cnt));
return -1;
}
sprintf(addr_str, "0x%x", (unsigned int)p_block);
sprintf(addr_str, "0x%x", (unsigned int)(uintptr_t)p_block);
ret = do_raw_read(NULL, 0, 6, argv);
if (ret) {
free(p_block);
@ -159,7 +159,7 @@ int bcb_rw_block(bool bread, char **ppblock,
*ppblock = p_block;
*pblksize = (uint)blk_size;
} else {
sprintf(addr_str, "0x%x", (unsigned int)pblock_write);
sprintf(addr_str, "0x%x", (unsigned int)(uintptr_t)pblock_write);
ret = do_write(NULL, 0, 6, argv);
if (ret) {
printf("do_write failed, ret %d\n", ret);


+ 1
- 1
drivers/usb/gadget/bcb.h View File

@ -48,7 +48,7 @@ struct bootloader_message_ab {
#define BOOTCTRL_OFFSET \
(u32)(&(((struct bootloader_message_ab *)0)->slot_suffix[BOOTCTRL_IDX]))
#define MISC_COMMAND \
(u32)(&(((struct bootloader_message *)0)->command[MISC_COMMAND_IDX]))
(u32)(uintptr_t)(&(((struct bootloader_message *)0)->command[MISC_COMMAND_IDX]))
int bcb_rw_block(bool bread, char **ppblock,
uint *pblksize, char *pblock_write, uint offset, uint size);


+ 8
- 8
drivers/usb/gadget/f_fastboot.c View File

@ -1073,7 +1073,7 @@ static void process_flash_mmc(const char *cmdbuf)
MMC_SATA_BLOCK_SIZE;
sprintf(mmc_write, "mmc write 0x%x 0x%x 0x%x",
(unsigned int)interface.transfer_buffer, /*source*/
(unsigned int)(uintptr_t)interface.transfer_buffer, /*source*/
ptn->start, /*dest*/
temp /*length*/);
@ -2352,7 +2352,7 @@ use_given_ptn:
if (check_image_arm64) {
if (mmc->block_dev.block_read(dev_desc, sector,
(hdr->kernel_size / 512) + 1,
(void *)hdr->kernel_addr) < 0) {
(void *)(uintptr_t)hdr->kernel_addr) < 0) {
printf("boota: mmc failed to read kernel\n");
goto fail;
}
@ -2363,7 +2363,7 @@ use_given_ptn:
sector += ALIGN(hdr->kernel_size, hdr->page_size) / 512;
if (mmc->block_dev.block_read(dev_desc, sector,
(hdr->ramdisk_size / 512) + 1,
(void *)hdr->ramdisk_addr) < 0) {
(void *)(uintptr_t)hdr->ramdisk_addr) < 0) {
printf("boota: mmc failed to read ramdisk\n");
goto fail;
}
@ -2376,7 +2376,7 @@ use_given_ptn:
sector += ALIGN(hdr->ramdisk_size, hdr->page_size) / 512;
if (mmc->block_dev.block_read(dev_desc, sector,
(hdr->second_size / 512) + 1,
(void *)hdr->second_addr) < 0) {
(void *)(uintptr_t)hdr->second_addr) < 0) {
printf("boota: mmc failed to dtb\n");
goto fail;
}
@ -2448,8 +2448,8 @@ use_given_ptn:
printf("Fail: boota address overlap with ramdisk address\n");
return 1;
}
memmove((void *) hdr->ramdisk_addr,
(void *)raddr, hdr->ramdisk_size);
memmove((void *)(uintptr_t)hdr->ramdisk_addr,
(void *)(uintptr_t)raddr, hdr->ramdisk_size);
}
#ifdef CONFIG_OF_LIBFDT
@ -2462,8 +2462,8 @@ use_given_ptn:
printf("Fail: boota address overlap with FDT address\n");
return 1;
}
memmove((void *) hdr->second_addr,
(void *)fdtaddr, hdr->second_size);
memmove((void *)(uintptr_t)hdr->second_addr,
(void *)(uintptr_t)fdtaddr, hdr->second_size);
}
#endif /*CONFIG_OF_LIBFDT*/
}


+ 4
- 0
include/fsl_fastboot.h View File

@ -200,6 +200,9 @@ void fastboot_run_bootmode(void);
/*Setup board-relative fastboot environment */
void board_fastboot_setup(void);
/*return partition index according name*/
int fastboot_flash_find_index(const char *name);
/*check whether bootloader is overlay with GPT table*/
bool bootloader_gpt_overlay(void);
/* Check whether the combo keys pressed
@ -208,6 +211,7 @@ bool bootloader_gpt_overlay(void);
*/
int is_recovery_key_pressing(void);
int fastboot_tx_write_str(const char *buffer);
#ifdef CONFIG_FASTBOOT_STORAGE_NAND
/*Save parameters for NAND storage partitions */
void save_parts_values(struct fastboot_ptentry *ptn,


+ 8
- 0
include/part.h View File

@ -334,6 +334,14 @@ int is_valid_gpt_buf(struct blk_desc *dev_desc, void *buf);
*/
int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf);
/**
* write_backup_gpt_partitions - write MBR, backup gpt table.
* @param dev_desc - block device descriptor
* @param buf - buffer which contains the MBR and Primary GPT info
*
* @return - '0' on success, otherwise error
*/
int write_backup_gpt_partitions(struct blk_desc *dev_desc, void *buf);
/**
* gpt_verify_headers() - Function to read and CRC32 check of the GPT's header
* and partition table entries (PTE)


Loading…
Cancel
Save