[PATCH 6/9] MCI: imx: Fix possible null pointer dereference

Alexander Shiyan shc_work at mail.ru
Fri Apr 26 12:41:11 EDT 2013


Signed-off-by: Alexander Shiyan <shc_work at mail.ru>
---
 drivers/mci/imx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mci/imx.c b/drivers/mci/imx.c
index 3d9bd0d..c985964 100644
--- a/drivers/mci/imx.c
+++ b/drivers/mci/imx.c
@@ -225,12 +225,13 @@ static int mxcmci_read_response(struct mxcmci_host *host, unsigned int stat)
 {
 	struct mci_cmd *cmd = host->cmd;
 	int i;
-	u32 a, b, c;
-	u32 *resp = (u32 *)cmd->response;
+	u32 a, b, c, *resp;
 
 	if (!cmd)
 		return 0;
 
+	resp = (u32 *)cmd->response;
+
 	if (stat & STATUS_TIME_OUT_RESP) {
 		printf("CMD TIMEOUT\n");
 		return -ETIMEDOUT;
-- 
1.8.1.5




More information about the barebox mailing list