* [U-Boot] [PATCH 1/1] fsl/sata: correctly identify failed malloc
@ 2017-04-15 13:31 Heinrich Schuchardt
2017-04-15 16:12 ` Tom Rini
2017-04-19 13:04 ` [U-Boot] [U-Boot, " Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2017-04-15 13:31 UTC (permalink / raw)
To: u-boot
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>
---
drivers/block/fsl_sata.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH 1/1] fsl/sata: correctly identify failed malloc
2017-04-15 13:31 [U-Boot] [PATCH 1/1] fsl/sata: correctly identify failed malloc Heinrich Schuchardt
@ 2017-04-15 16:12 ` Tom Rini
2017-04-19 13:04 ` [U-Boot] [U-Boot, " Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2017-04-15 16:12 UTC (permalink / raw)
To: u-boot
On Sat, Apr 15, 2017 at 03:31:53PM +0200, Heinrich Schuchardt wrote:
> 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>
--
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [U-Boot, 1/1] fsl/sata: correctly identify failed malloc
2017-04-15 13:31 [U-Boot] [PATCH 1/1] fsl/sata: correctly identify failed malloc Heinrich Schuchardt
2017-04-15 16:12 ` Tom Rini
@ 2017-04-19 13:04 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2017-04-19 13:04 UTC (permalink / raw)
To: u-boot
On Sat, Apr 15, 2017 at 03:31:53PM +0200, xypron.glpk at gmx.de wrote:
> 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>
Applied to u-boot/master, thanks!
--
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-19 13:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-15 13:31 [U-Boot] [PATCH 1/1] fsl/sata: correctly identify failed malloc Heinrich Schuchardt
2017-04-15 16:12 ` Tom Rini
2017-04-19 13:04 ` [U-Boot] [U-Boot, " Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.