summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorxypron.glpk@gmx.de <xypron.glpk@gmx.de>2017-04-15 15:31:53 +0200
committerTom Rini <trini@konsulko.com>2017-04-18 10:29:24 -0400
commit7a931b958e4f942b16d3f5d31dc4c0982fa186c8 (patch)
treede04bc52d19a3ef1fc7858d73b91312fae1381d1 /drivers/block
parent0e0de24b07b8314ea0cc247a89b722c2230e4b0a (diff)
downloadu-boot-7a931b958e4f942b16d3f5d31dc4c0982fa186c8.tar.gz
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 <xypron.glpk@gmx.de> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/fsl_sata.c2
1 files changed, 1 insertions, 1 deletions
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;
}