fsl/sata: correctly identify failed malloc
PATCH 1/1 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 <[email protected]>
--- drivers/block/fsl_sata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/fsl_sata.c +1 -1
@@ -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 ; }
Signature · 1 line
2.11.0
PATCH 1/1 fsl/sata: correctly identify failed malloc
Quoted 6 lines · Heinrich Schuchardt
After allocating
sata->cmd_hdr_tbl_offsetwe have to check this variable and not variable sata.The problem was indicated by cppcheck.
Signed-off-by Heinrich Schuchardt <[email protected]>
Reviewed-by Tom Rini <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170415/91b75bd1/attachment.sig>
PATCH 1/1 fsl/sata: correctly identify failed malloc
In reply to Heinrich SchuchardtQuoted 7 lines · xypron.glpk at gmx.de
After allocating
sata->cmd_hdr_tbl_offsetwe have to check this variable and not variable sata.The problem was indicated by cppcheck.
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170419/1187cea9/attachment.sig>