X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fblock%2Ffsl_sata.c;h=31f7fab8b47aaae1fdc6dda5001a123506250053;hb=a821c4af79e4f5ce9b629b20473863397bbe9b10;hp=71d7cec7bdd2256877105555b9e4904b1438cc93;hpb=1fc4e6f486cc1e9d2dcf0ba86e6021c3d83dce51;p=u-boot diff --git a/drivers/block/fsl_sata.c b/drivers/block/fsl_sata.c index 71d7cec7bd..31f7fab8b4 100644 --- a/drivers/block/fsl_sata.c +++ b/drivers/block/fsl_sata.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -113,7 +114,7 @@ int init_sata(int dev) /* Save the private struct to block device struct */ sata_dev_desc[dev].priv = (void *)sata; - sprintf(sata->name, "SATA%d", dev); + snprintf(sata->name, 12, "SATA%d", dev); /* Set the controller register base address to device struct */ reg = (fsl_sata_reg_t *)(fsl_sata_info[dev].sata_reg_base); @@ -123,7 +124,7 @@ int init_sata(int dev) length = sizeof(struct cmd_hdr_tbl); align = SATA_HC_CMD_HDR_TBL_ALIGN; sata->cmd_hdr_tbl_offset = (void *)malloc(length + align); - if (!sata) { + if (!sata->cmd_hdr_tbl_offset) { printf("alloc the command header failed\n\r"); return -1; } @@ -397,7 +398,7 @@ static int fsl_ata_exec_ata_cmd(struct fsl_sata *sata, struct sata_fis_h2d *cfis debug("attribute = %08x\n\r", val32); cmd_hdr->attribute = cpu_to_le32(val32); - /* Make sure cmd desc and cmd slot valid before commmand issue */ + /* Make sure cmd desc and cmd slot valid before command issue */ sync(); /* PMP*/