From cd7b3fbcf46844230ad664884c18d0281a4a31d7 Mon Sep 17 00:00:00 2001 From: Prabhakar Kushwaha Date: Fri, 18 Mar 2016 16:15:29 +0530 Subject: driver: net: fsl-mc: Free dflt_dpio pointer after its usage Free dflt_dpio pointer after its usage during error handling Signed-off-by: Prabhakar Kushwaha Reported-by: Jose Rivera Reviewed-by: York Sun --- drivers/net/fsl-mc/mc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net') diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c index f83bd0c7f0..d2b8b5c47f 100644 --- a/drivers/net/fsl-mc/mc.c +++ b/drivers/net/fsl-mc/mc.c @@ -747,11 +747,11 @@ static int dpio_init(void) err_get_swp_init: dpio_disable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio->dpio_handle); err_get_enable: - free(dflt_dpio); err_get_attr: dpio_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio->dpio_handle); dpio_destroy(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio->dpio_handle); err_create: + free(dflt_dpio); err_malloc: return err; } -- cgit v1.2.1 From b576d325acbcbe05d712e3a995b4ce6689eb96c5 Mon Sep 17 00:00:00 2001 From: Prabhakar Kushwaha Date: Fri, 18 Mar 2016 16:16:03 +0530 Subject: 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 Reported-by: Jose Rivera Acked-by: Joe Hershberger Reviewed-by: York Sun --- drivers/net/fsl-mc/dpio/qbman_sys.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net') diff --git a/drivers/net/fsl-mc/dpio/qbman_sys.h b/drivers/net/fsl-mc/dpio/qbman_sys.h index 235d641bd4..7a537fb82d 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 -- cgit v1.2.1