On Fri, Nov 28, 2014 at 02:31:56PM +0800, micky_ching@xxxxxxxxxxxxxx wrote: > #ifdef DEBUG > -static void sd_print_debug_regs(struct realtek_pci_sdmmc *host) > +static void dump_reg_range(struct realtek_pci_sdmmc *host, u16 start, u16 end) > { > - struct rtsx_pcr *pcr = host->pcr; > - u16 i; > - u8 *ptr; > + u16 len = end - start + 1; > + int i; > + u8 data[8]; > > - /* Print SD host internal registers */ > - rtsx_pci_init_cmd(pcr); > - for (i = 0xFDA0; i <= 0xFDAE; i++) > - rtsx_pci_add_cmd(pcr, READ_REG_CMD, i, 0, 0); > - for (i = 0xFD52; i <= 0xFD69; i++) > - rtsx_pci_add_cmd(pcr, READ_REG_CMD, i, 0, 0); > - rtsx_pci_send_cmd(pcr, 100); > - > - ptr = rtsx_pci_get_cmd_data(pcr); > - for (i = 0xFDA0; i <= 0xFDAE; i++) > - dev_dbg(sdmmc_dev(host), "0x%04X: 0x%02x\n", i, *(ptr++)); > - for (i = 0xFD52; i <= 0xFD69; i++) > - dev_dbg(sdmmc_dev(host), "0x%04X: 0x%02x\n", i, *(ptr++)); > + if (!data) > + return; Delete this check. It will cause a static checker warning because arrays never NULL. > + > + for (i = 0; i < len; i += 8) { > + int j; > + int n = min(8, len - i); > + > + memset(&data, 0, sizeof(data)); > + for (j = 0; j < n; j++) > + rtsx_pci_read_register(host->pcr, start + i + j, > + data + j); > + dev_dbg(sdmmc_dev(host), "0x%04X(%d): %8ph\n", start, n, data); This should be start + i, sorry for not spotting that earlier. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html