Skip to contentSkip to conversation

serial: imx: initialize the local variable

PATCH New Huang Shijie 2 participants 2 messages Aug 29, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: imx: initialize the local variable

The slave_config is not initialized, so some of its fields may be set with random data which may causes the failure in the following dmaengine_prep_slave_sg().

This patch fixes this issue.

---
 drivers/tty/serial/imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/tty/serial/imx.c +1 -1
index 2c13155..a0ebbc9 100644
@@ -979,7 +979,7 @@ static void imx_uart_dma_exit(struct imx_port *sport)
 
 static int imx_uart_dma_init(struct imx_port *sport)
 {
-	struct dma_slave_config slave_config;
+	struct dma_slave_config slave_config = {};
 	struct device *dev = sport->port.dev;
 	int ret;
 
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 serial: imx: initialize the local variable

Quoted 7 lines · Huang Shijie

The slave_config is not initialized, so some of its fields may be set with random data which may causes the failure in the following dmaengine_prep_slave_sg().

This patch fixes this issue.

Quoted 21 lines
---
 drivers/tty/serial/imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/tty/serial/imx.c +1 -1
index 2c13155..a0ebbc9 100644
@@ -979,7 +979,7 @@ static void imx_uart_dma_exit(struct imx_port *sport)
 
 static int imx_uart_dma_init(struct imx_port *sport)
 {
-	struct dma_slave_config slave_config;
+	struct dma_slave_config slave_config = {};
 	struct device *dev = sport->port.dev;
 	int ret;
 
Signature · 1 line
1.7.1