From: xypron.glpk@gmx.de Date: Sat, 15 Apr 2017 13:31:53 +0000 (+0200) Subject: fsl/sata: correctly identify failed malloc X-Git-Tag: v2017.05-rc3~67 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7a931b958e4f942b16d3f5d31dc4c0982fa186c8;p=oweals%2Fu-boot.git fsl/sata: correctly identify failed malloc After allocating sata->cmd_hdr_tbl_offset we have to check this variable and not variable sata. The problem was indicated by cppcheck. Signed-off-by: Heinrich Schuchardt Reviewed-by: Tom Rini --- diff --git a/drivers/block/fsl_sata.c b/drivers/block/fsl_sata.c index e000ebff76..31f7fab8b4 100644 --- a/drivers/block/fsl_sata.c +++ b/drivers/block/fsl_sata.c @@ -124,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; }