Skip to contentSkip to conversation

console: Fix possible null pointer dereference

PATCH In review Alexander Shiyan 3 participants 19 messages Apr 26, 2013 – Apr 30, 2013

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

PATCH 1/9 console: Fix possible null pointer dereference

---
 common/console.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)
common/console.c +15 -15
index beb37bd..965be03 100644
@@ -62,23 +62,23 @@ static int console_std_set(struct device_d *dev, struct param_d *param,
 	char active[4];
 	unsigned int flag = 0, i = 0;
 
-	if (!val)
-		dev_param_set_generic(dev, param, NULL);
-
-	if (strchr(val, 'i') && cdev->f_caps & CONSOLE_STDIN) {
-		active[i++] = 'i';
-		flag |= CONSOLE_STDIN;
-	}
+	if (val) {
+		if (strchr(val, 'i') && cdev->f_caps & CONSOLE_STDIN) {
+			active[i++] = 'i';
+			flag |= CONSOLE_STDIN;
+		}
 
-	if (strchr(val, 'o') && cdev->f_caps & CONSOLE_STDOUT) {
-		active[i++] = 'o';
-		flag |= CONSOLE_STDOUT;
-	}
+		if (strchr(val, 'o') && cdev->f_caps & CONSOLE_STDOUT) {
+			active[i++] = 'o';
+			flag |= CONSOLE_STDOUT;
+		}
 
-	if (strchr(val, 'e') && cdev->f_caps & CONSOLE_STDERR) {
-		active[i++] = 'e';
-		flag |= CONSOLE_STDERR;
-	}
+		if (strchr(val, 'e') && cdev->f_caps & CONSOLE_STDERR) {
+			active[i++] = 'e';
+			flag |= CONSOLE_STDERR;
+		}
+	} else
+		dev_param_set_generic(dev, param, NULL);
 
 	active[i] = 0;
 	cdev->f_active = flag;
Signature · 7 lines
1.8.1.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 2/9 ARM: at91 gpio: Fix possible null pointer dereference

---
 arch/arm/mach-at91/gpio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-at91/gpio.c +3 -2
index c2618c7..0e39a52 100644
@@ -185,10 +185,10 @@ static struct at91_pinctrl_mux_ops at91sam9x5_ops = {
 int at91_mux_pin(unsigned pin, enum at91_mux mux, int use_pullup)
 {
 	struct at91_gpio_chip *at91_gpio = pin_to_controller(pin);
-	void __iomem *pio = at91_gpio->regbase;
+	void __iomem *pio;
+	struct device_d *dev;
 	unsigned mask = pin_to_mask(pin);
 	int bank = pin_to_bank(pin);
-	struct device_d *dev = at91_gpio->chip.dev;
 
 	if (!at91_gpio)
 		return -EINVAL;
@@ -197,6 +197,7 @@ int at91_mux_pin(unsigned pin, enum at91_mux mux, int use_pullup)
 	if (!pio)
 		return -EINVAL;
 
+	dev = at91_gpio->chip.dev;
 	at91_mux_disable_interrupt(pio, mask);
 
 	pin %= MAX_NB_GPIO_PER_BANK;
Signature · 7 lines
1.8.1.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH 3/9 ARM: at91 smc: Fix possible uninitialized variable

In reply to Alexander Shiyan
---
 arch/arm/mach-at91/sam9_smc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-at91/sam9_smc.c +4 -4
index b48275e..a137da4 100644
@@ -120,12 +120,12 @@ void sam9_smc_read(int id, int cs, struct sam9_smc_config *config)
 
 static int at91sam9_smc_probe(struct device_d *dev)
 {
-	int id;
+	int id = dev->id;
 
-	if (dev->id < 0) {
+	if (id < 0) {
 		id = 0;
-	} else if (dev->id > 1) {
-		dev_warn(dev, ": id > 2\n");
+	} else if (id > 1) {
+		dev_warn(dev, "id > 1\n");
 		return -EIO;
 	}
 
Signature · 7 lines
1.8.1.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw

PATCH 4/9 MCI: atmel: Fix possible null pointer dereference

In reply to Alexander Shiyan
---
 drivers/mci/atmel_mci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mci/atmel_mci.c +3 -1
index f032403..c5fd306 100644
@@ -262,11 +262,13 @@ static int atmci_read_response(struct atmel_mci *host, unsigned int stat)
 {
 	struct mci_cmd *cmd = host->cmd;
 	int i;
-	u32 *resp = (u32 *)cmd->response;
+	u32 *resp;
 
 	if (!cmd)
 		return 0;
 
+	resp = (u32 *)cmd->response;
+
 	if (stat & (ATMCI_RTOE | ATMCI_DTOE)) {
 		dev_err(host->hw_dev, "command/data timeout\n");
 		return -ETIMEDOUT;
Signature · 7 lines
1.8.1.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#9 lore raw

PATCH 5/9 MCI: imx-esdhc: Fix possible null pointer dereference

In reply to Alexander Shiyan
---
 drivers/mci/imx-esdhc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mci/imx-esdhc.c +6 -1
index 8c2695c..8194b4d 100644
@@ -450,10 +450,15 @@ static int esdhc_card_present(struct mci_host *mci)
 static int esdhc_init(struct mci_host *mci, struct device_d *dev)
 {
 	struct fsl_esdhc_host *host = to_fsl_esdhc(mci);
-	struct fsl_esdhc __iomem *regs = host->regs;
+	struct fsl_esdhc __iomem *regs;
 	int timeout = 1000;
 	int ret = 0;
 
+	if (!host)
+		return -EIO;
+
+	regs = host->regs;
+
 	/* Enable cache snooping */
 	if (host && !host->no_snoop)
 		esdhc_write32(&regs->scr, 0x00000040);
Signature · 7 lines
1.8.1.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#12 lore raw

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

In reply to Alexander Shiyan
---
 drivers/mci/imx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mci/imx.c +3 -2
index 3d9bd0d..c985964 100644
@@ -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;
Signature · 7 lines
1.8.1.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#13 lore raw

PATCH 7/9 NAND: imx: Fix memory leak

In reply to Alexander Shiyan
---
 drivers/mtd/nand/nand_imx_bbm.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/mtd/nand/nand_imx_bbm.c +6 -3
index 03961a0..135d74e 100644
@@ -91,7 +91,7 @@ static void *create_bbt(struct mtd_info *mtd)
 	buf = malloc(mtd->writesize);
 	if (!buf) {
 		ret = -ENOMEM;
-		goto out;
+		goto out2;
 	}
 
 	numblocks = mtd->size >> (chip->bbt_erase_shift - 1);
@@ -99,7 +99,7 @@ static void *create_bbt(struct mtd_info *mtd)
 	for (i = 0; i < numblocks;) {
 		ret = checkbad(mtd, from, buf);
 		if (ret < 0)
-			goto out;
+			goto out1;
 
 		if (ret) {
 			bbt[i >> 3] |= 0x03 << (i & 0x6);
@@ -112,8 +112,11 @@ static void *create_bbt(struct mtd_info *mtd)
 	}
 
 	return bbt;
-out:
+
+out1:
 	free(buf);
+out2:
+	free(bbt);
 
 	return ERR_PTR(ret);
 }
Signature · 7 lines
1.8.1.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#14 lore raw

PATCH 8/9 Serial: mpc5xxx: Fix setup mode at port initialization

In reply to Alexander Shiyan
---
 drivers/serial/serial_mpc5xxx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/serial/serial_mpc5xxx.c +2 -4
index 532eea3..ed77807 100644
@@ -82,12 +82,10 @@ static int __mpc5xxx_serial_init(struct mpc5xxx_psc *psc)
 	psc->sicr = 0;
 
 	/* configure parity, bit length and so on */
+	psc->mode = PSC_MODE_8_BITS | PSC_MODE_PARNONE | PSC_MODE_ONE_STOP;
 #if defined(CONFIG_MGT5100)
-	psc->mode = PSC_MODE_ERR | PSC_MODE_8_BITS | PSC_MODE_PARNONE;
-#elif defined(CONFIG_MPC5200)
-	psc->mode = PSC_MODE_8_BITS | PSC_MODE_PARNONE;
+	psc->mode |= PSC_MODE_ERR;
 #endif
-	psc->mode = PSC_MODE_ONE_STOP;
 
 	/* disable all interrupts */
 	psc->psc_imr = 0;
Signature · 7 lines
1.8.1.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#17 lore raw

PATCH 9/9 MCI: imx-esdhc: Remove now unneeded check

In reply to Alexander Shiyan
---
 drivers/mci/imx-esdhc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mci/imx-esdhc.c +1 -1
index 8194b4d..8133d2e 100644
@@ -460,7 +460,7 @@ static int esdhc_init(struct mci_host *mci, struct device_d *dev)
 	regs = host->regs;
 
 	/* Enable cache snooping */
-	if (host && !host->no_snoop)
+	if (!host->no_snoop)
 		esdhc_write32(&regs->scr, 0x00000040);
 
 	/* Reset the entire host controller */
Signature · 7 lines
1.8.1.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

Re: [PATCH 3/9] ARM: at91 smc: Fix possible uninitialized variable

In reply to Alexander Shiyan
Quoted 11 lines · Alexander Shiyan
---
 arch/arm/mach-at91/sam9_smc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-at91/sam9_smc.c +0 -0
index b48275e..a137da4 100644

arch/arm/mach-at91/sam9_smc.c void sam9_smc_read(int id, int cs, struct sam9_smc_config *config) · line 122

Quoted 3 lines
arch/arm/mach-at91/sam9_smc.c +0 -0
@@ -120,12 +120,12 @@ void sam9_smc_read(int id, int cs, struct sam9_smc_config *config)
 
 static int at91sam9_smc_probe(struct device_d *dev)
 {

you fix nothing here

Quoted 21 lines
arch/arm/mach-at91/sam9_smc.c +4 -4
-	int id;
+	int id = dev->id;
 
-	if (dev->id < 0) {
+	if (id < 0) {
 		id = 0;
-	} else if (dev->id > 1) {
-		dev_warn(dev, ": id > 2\n");
+	} else if (id > 1) {
+		dev_warn(dev, "id > 1\n");
 		return -EIO;
 	}
 
Signature · 7 lines
1.8.1.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#2 lore raw

Re: [PATCH 2/9] ARM: at91 gpio: Fix possible null pointer dereference

In reply to Alexander Shiyan
Quoted 11 lines · Alexander Shiyan
---
 arch/arm/mach-at91/gpio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-at91/gpio.c +0 -0
index c2618c7..0e39a52 100644

arch/arm/mach-at91/gpio.c static struct at91_pinctrl_mux_ops at91sam9x5_ops = { · line 191

Quoted 9 lines
arch/arm/mach-at91/gpio.c +2 -2
@@ -185,10 +185,10 @@ static struct at91_pinctrl_mux_ops at91sam9x5_ops = {
 int at91_mux_pin(unsigned pin, enum at91_mux mux, int use_pullup)
 {
 	struct at91_gpio_chip *at91_gpio = pin_to_controller(pin);
-	void __iomem *pio = at91_gpio->regbase;
+	void __iomem *pio;
+	struct device_d *dev;
 	unsigned mask = pin_to_mask(pin);
 	int bank = pin_to_bank(pin);
-	struct device_d *dev = at91_gpio->chip.dev;

so crash

Quoted 19 lines
arch/arm/mach-at91/gpio.c +1 -0
 	if (!at91_gpio)
 		return -EINVAL;
@@ -197,6 +197,7 @@ int at91_mux_pin(unsigned pin, enum at91_mux mux, int use_pullup)
 	if (!pio)
 		return -EINVAL;
 
+	dev = at91_gpio->chip.dev;
 	at91_mux_disable_interrupt(pio, mask);
 
 	pin %= MAX_NB_GPIO_PER_BANK;
Signature · 7 lines
1.8.1.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#6 lore raw

Re[2]: [PATCH 3/9] ARM: at91 smc: Fix possible uninitialized variable

In reply to Jean-Christophe PLAGNIOL-VILLARD

...

Quoted 9 lines
Quoted 9 lines
 arch/arm/mach-at91/sam9_smc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-at91/sam9_smc.c +0 -0
index b48275e..a137da4 100644
@@ -120,12 +120,12 @@ void sam9_smc_read(int id, int cs, struct sam9_smc_config *config)
 
Quoted 3 lines

arch/arm/mach-at91/sam9_smc.c void sam9_smc_read(int id, int cs, struct sam9_smc_config *config) · line 122

Quoted 2 lines
arch/arm/mach-at91/sam9_smc.c +0 -0
 static int at91sam9_smc_probe(struct device_d *dev)
 {

you fix nothing here

As far I understand, id can be 0 and 1. In case of dev->id=1, id is not set.

Quoted 12 lines

arch/arm/mach-at91/sam9_smc.c void sam9_smc_read(int id, int cs, struct sam9_smc_config *config) · line 130

Quoted 12 lines
arch/arm/mach-at91/sam9_smc.c +4 -4
-	int id;
+	int id = dev->id;
 
-	if (dev->id < 0) {
+	if (id < 0) {
 		id = 0;
-	} else if (dev->id > 1) {
-		dev_warn(dev, ": id > 2\n");
+	} else if (id > 1) {
+		dev_warn(dev, "id > 1\n");
 		return -EIO;
 	}

---
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

maintainer
#3 lore raw

Re: [PATCH 2/9] ARM: at91 gpio: Fix possible null pointer dereference

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · Alexander Shiyan
---
 arch/arm/mach-at91/gpio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Quoted 15 lines
Quoted 5 lines
arch/arm/mach-at91/gpio.c +0 -0
index c2618c7..0e39a52 100644

arch/arm/mach-at91/gpio.c static struct at91_pinctrl_mux_ops at91sam9x5_ops = { · line 191

Quoted 9 lines
arch/arm/mach-at91/gpio.c +2 -2
@@ -185,10 +185,10 @@ static struct at91_pinctrl_mux_ops at91sam9x5_ops = {
 int at91_mux_pin(unsigned pin, enum at91_mux mux, int use_pullup)
 {
 	struct at91_gpio_chip *at91_gpio = pin_to_controller(pin);
-	void __iomem *pio = at91_gpio->regbase;
+	void __iomem *pio;
+	struct device_d *dev;
 	unsigned mask = pin_to_mask(pin);
 	int bank = pin_to_bank(pin);
-	struct device_d *dev = at91_gpio->chip.dev;

so crash

means what? the original code derefences at91_gpio...

Quoted 3 lines

arch/arm/mach-at91/gpio.c static struct at91_pinctrl_mux_ops at91sam9x5_ops = { · line 194

Quoted 3 lines
arch/arm/mach-at91/gpio.c +0 -0
 	if (!at91_gpio)
 		return -EINVAL;

...and then checks if at91_gpio is valid which makes no sense.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer
#7 lore raw

Re: [PATCH 3/9] ARM: at91 smc: Fix possible uninitialized variable

In reply to Alexander Shiyan
Quoted 19 lines · Alexander Shiyan

...

Quoted 9 lines
Quoted 9 lines
 arch/arm/mach-at91/sam9_smc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-at91/sam9_smc.c +0 -0
index b48275e..a137da4 100644
@@ -120,12 +120,12 @@ void sam9_smc_read(int id, int cs, struct sam9_smc_config *config)
 
Quoted 3 lines

arch/arm/mach-at91/sam9_smc.c void sam9_smc_read(int id, int cs, struct sam9_smc_config *config) · line 122

Quoted 2 lines
arch/arm/mach-at91/sam9_smc.c +0 -0
 static int at91sam9_smc_probe(struct device_d *dev)
 {

you fix nothing here

As far I understand, id can be 0 and 1. In case of dev->id=1, id is not set.

Quoted 3 lines
Quoted 3 lines
arch/arm/mach-at91/sam9_smc.c +1 -1
-	int id;
+	int id = dev->id;
 
Quoted 7 lines
Quoted 7 lines

arch/arm/mach-at91/sam9_smc.c void sam9_smc_read(int id, int cs, struct sam9_smc_config *config) · line 128

Quoted 7 lines
arch/arm/mach-at91/sam9_smc.c +3 -3
-	if (dev->id < 0) {
+	if (id < 0) {
 		id = 0;
-	} else if (dev->id > 1) {
-		dev_warn(dev, ": id > 2\n");
+	} else if (id > 1) {
+		dev_warn(dev, "id > 1\n");

Also it fixes the error message.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer
#10 lore raw

Re: [PATCH 5/9] MCI: imx-esdhc: Fix possible null pointer dereference

In reply to Alexander Shiyan
Quoted 11 lines · Alexander Shiyan
---
 drivers/mci/imx-esdhc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mci/imx-esdhc.c +0 -0
index 8c2695c..8194b4d 100644

drivers/mci/imx-esdhc.c static int esdhc_card_present(struct mci_host *mci) · line 458

Quoted 10 lines
drivers/mci/imx-esdhc.c +3 -1
@@ -450,10 +450,15 @@ static int esdhc_card_present(struct mci_host *mci)
 static int esdhc_init(struct mci_host *mci, struct device_d *dev)
 {
 	struct fsl_esdhc_host *host = to_fsl_esdhc(mci);
-	struct fsl_esdhc __iomem *regs = host->regs;
+	struct fsl_esdhc __iomem *regs;
 	int timeout = 1000;
 	int ret = 0;
 
+	if (!host)
+		return -EIO;

How should that happen? The mci core should not call this callback with a NULL pointer, and if it does, there is a bug in the mci core.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer
#18 lore raw

Re: [PATCH 9/9] MCI: imx-esdhc: Remove now unneeded check

In reply to Alexander Shiyan
Quoted 11 lines · Alexander Shiyan
---
 drivers/mci/imx-esdhc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mci/imx-esdhc.c +0 -0
index 8194b4d..8133d2e 100644

drivers/mci/imx-esdhc.c static int esdhc_init(struct mci_host *mci, struct device_d *dev) · line 464

Quoted 6 lines
drivers/mci/imx-esdhc.c +1 -1
@@ -460,7 +460,7 @@ static int esdhc_init(struct mci_host *mci, struct device_d *dev)
 	regs = host->regs;
 
 	/* Enable cache snooping */
-	if (host && !host->no_snoop)
+	if (!host->no_snoop)
 		esdhc_write32(&regs->scr, 0x00000040);

These lines are removed by:

mci: imx-esdhc: remove cache snoop register access

So we can skip this patch.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#11 lore raw

Re[2]: [PATCH 5/9] MCI: imx-esdhc: Fix possible null pointer dereference

In reply to Sascha Hauer
Quoted 20 lines · Alexander Shiyan
Quoted 19 lines
---
 drivers/mci/imx-esdhc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mci/imx-esdhc.c +1 -1
index 8c2695c..8194b4d 100644
@@ -450,10 +450,15 @@ static int esdhc_card_present(struct mci_host *mci)
 static int esdhc_init(struct mci_host *mci, struct device_d *dev)
 {
 	struct fsl_esdhc_host *host = to_fsl_esdhc(mci);
-	struct fsl_esdhc __iomem *regs = host->regs;
+	struct fsl_esdhc __iomem *regs;
 	int timeout = 1000;
 	int ret = 0;
 
Quoted 5 lines

drivers/mci/imx-esdhc.c static int esdhc_card_present(struct mci_host *mci) · line 458

Quoted 2 lines
drivers/mci/imx-esdhc.c +2 -0
+	if (!host)
+		return -EIO;

How should that happen? The mci core should not call this callback with a NULL pointer, and if it does, there is a bug in the mci core.

Pls, just drop 5/9 and 9/9.
Thanks.

---
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

maintainer
#15 lore raw

Re: [PATCH 8/9] Serial: mpc5xxx: Fix setup mode at port initialization

In reply to Alexander Shiyan
Quoted 12 lines · Alexander Shiyan
---
 drivers/serial/serial_mpc5xxx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/serial/serial_mpc5xxx.c +0 -0
index 532eea3..ed77807 100644
@@ -82,12 +82,10 @@ static int __mpc5xxx_serial_init(struct mpc5xxx_psc *psc)
 	psc->sicr = 0;

drivers/serial/serial_mpc5xxx.c static int __mpc5xxx_serial_init(struct mpc5xxx_psc *psc) · line 90

Quoted 10 lines
drivers/serial/serial_mpc5xxx.c +2 -4
 
 	/* configure parity, bit length and so on */
+	psc->mode = PSC_MODE_8_BITS | PSC_MODE_PARNONE | PSC_MODE_ONE_STOP;
 #if defined(CONFIG_MGT5100)
-	psc->mode = PSC_MODE_ERR | PSC_MODE_8_BITS | PSC_MODE_PARNONE;
-#elif defined(CONFIG_MPC5200)
-	psc->mode = PSC_MODE_8_BITS | PSC_MODE_PARNONE;
+	psc->mode |= PSC_MODE_ERR;
 #endif
-	psc->mode = PSC_MODE_ONE_STOP;

Without this patch psc->mode gets configured differently on mpc5200 and on mgt5100, then afterwards overwritten on both. This surely was not intended, but nevertheless the driver works as expected. Was this patch tested?

BTW CONFIG_MGT5100 could be removed, we do not have support for this SoC.

Meanwhile I applied most patches of this series.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#16 lore raw

Re[2]: [PATCH 8/9] Serial: mpc5xxx: Fix setup mode at port initialization

Quoted 14 lines · Alexander Shiyan
Quoted 13 lines
---
 drivers/serial/serial_mpc5xxx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/serial/serial_mpc5xxx.c +0 -0
index 532eea3..ed77807 100644
@@ -82,12 +82,10 @@ static int __mpc5xxx_serial_init(struct mpc5xxx_psc *psc)
 	psc->sicr = 0;
 
Quoted 14 lines

drivers/serial/serial_mpc5xxx.c static int __mpc5xxx_serial_init(struct mpc5xxx_psc *psc) · line 90

Quoted 9 lines
drivers/serial/serial_mpc5xxx.c +2 -4
 	/* configure parity, bit length and so on */
+	psc->mode = PSC_MODE_8_BITS | PSC_MODE_PARNONE | PSC_MODE_ONE_STOP;
 #if defined(CONFIG_MGT5100)
-	psc->mode = PSC_MODE_ERR | PSC_MODE_8_BITS | PSC_MODE_PARNONE;
-#elif defined(CONFIG_MPC5200)
-	psc->mode = PSC_MODE_8_BITS | PSC_MODE_PARNONE;
+	psc->mode |= PSC_MODE_ERR;
 #endif
-	psc->mode = PSC_MODE_ONE_STOP;

Without this patch psc->mode gets configured differently on mpc5200 and on mgt5100, then afterwards overwritten on both. This surely was not intended, but nevertheless the driver works as expected. Was this patch tested?

No. I not have such hardware.

Quoted 4 lines

BTW CONFIG_MGT5100 could be removed, we do not have support for this SoC.

Meanwhile I applied most patches of this series.

OK.

---
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox