summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrabhakar Kushwaha <prabhakar.kushwaha@nxp.com>2016-03-18 16:16:03 +0530
committerYork Sun <york.sun@nxp.com>2016-03-29 08:46:01 -0700
commitb576d325acbcbe05d712e3a995b4ce6689eb96c5 (patch)
treefc43c17965c8d577bea1d8ac290612f1e352eced
parentcd7b3fbcf46844230ad664884c18d0281a4a31d7 (diff)
downloadu-boot-imx-b576d325acbcbe05d712e3a995b4ce6689eb96c5.zip
u-boot-imx-b576d325acbcbe05d712e3a995b4ce6689eb96c5.tar.gz
u-boot-imx-b576d325acbcbe05d712e3a995b4ce6689eb96c5.tar.bz2
driver: net: fsl-mc: Check NULL before pointer dereference
NULL pointer should be checked before any dereference. This patch move memest after the NULL pointer check. Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com> Reported-by: Jose Rivera <german.rivera@nxp.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: York Sun <york.sun@nxp.com>
-rw-r--r--drivers/net/fsl-mc/dpio/qbman_sys.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/fsl-mc/dpio/qbman_sys.h b/drivers/net/fsl-mc/dpio/qbman_sys.h
index 235d641..7a537fb 100644
--- a/drivers/net/fsl-mc/dpio/qbman_sys.h
+++ b/drivers/net/fsl-mc/dpio/qbman_sys.h
@@ -255,11 +255,11 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s,
s->addr_cena = d->cena_bar;
s->addr_cinh = d->cinh_bar;
s->cena = (void *)valloc(CONFIG_SYS_PAGE_SIZE);
- memset((void *)s->cena, 0x00, CONFIG_SYS_PAGE_SIZE);
if (!s->cena) {
printf("Could not allocate page for cena shadow\n");
return -1;
}
+ memset((void *)s->cena, 0x00, CONFIG_SYS_PAGE_SIZE);
#ifdef QBMAN_CHECKING
/* We should never be asked to initialise for a portal that isn't in