mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/9] console: Fix possible null pointer dereference
@ 2013-04-26 16:41 Alexander Shiyan
  2013-04-26 16:41 ` [PATCH 2/9] ARM: at91 gpio: " Alexander Shiyan
                   ` (7 more replies)
  0 siblings, 8 replies; 19+ messages in thread
From: Alexander Shiyan @ 2013-04-26 16:41 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 common/console.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/common/console.c b/common/console.c
index beb37bd..965be03 100644
--- a/common/console.c
+++ b/common/console.c
@@ -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;
-- 
1.8.1.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 2/9] ARM: at91 gpio: Fix possible null pointer dereference
  2013-04-26 16:41 [PATCH 1/9] console: Fix possible null pointer dereference Alexander Shiyan
@ 2013-04-26 16:41 ` Alexander Shiyan
  2013-04-26 16:59   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-04-26 16:41 ` [PATCH 3/9] ARM: at91 smc: Fix possible uninitialized variable Alexander Shiyan
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Alexander Shiyan @ 2013-04-26 16:41 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/mach-at91/gpio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index c2618c7..0e39a52 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -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;
-- 
1.8.1.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 3/9] ARM: at91 smc: Fix possible uninitialized variable
  2013-04-26 16:41 [PATCH 1/9] console: Fix possible null pointer dereference Alexander Shiyan
  2013-04-26 16:41 ` [PATCH 2/9] ARM: at91 gpio: " Alexander Shiyan
@ 2013-04-26 16:41 ` Alexander Shiyan
  2013-04-26 16:59   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-04-26 16:41 ` [PATCH 4/9] MCI: atmel: Fix possible null pointer dereference Alexander Shiyan
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Alexander Shiyan @ 2013-04-26 16:41 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/mach-at91/sam9_smc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-at91/sam9_smc.c b/arch/arm/mach-at91/sam9_smc.c
index b48275e..a137da4 100644
--- a/arch/arm/mach-at91/sam9_smc.c
+++ b/arch/arm/mach-at91/sam9_smc.c
@@ -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;
 	}
 
-- 
1.8.1.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 4/9] MCI: atmel: Fix possible null pointer dereference
  2013-04-26 16:41 [PATCH 1/9] console: Fix possible null pointer dereference Alexander Shiyan
  2013-04-26 16:41 ` [PATCH 2/9] ARM: at91 gpio: " Alexander Shiyan
  2013-04-26 16:41 ` [PATCH 3/9] ARM: at91 smc: Fix possible uninitialized variable Alexander Shiyan
@ 2013-04-26 16:41 ` Alexander Shiyan
  2013-04-26 16:41 ` [PATCH 5/9] MCI: imx-esdhc: " Alexander Shiyan
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Alexander Shiyan @ 2013-04-26 16:41 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/mci/atmel_mci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mci/atmel_mci.c b/drivers/mci/atmel_mci.c
index f032403..c5fd306 100644
--- a/drivers/mci/atmel_mci.c
+++ b/drivers/mci/atmel_mci.c
@@ -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;
-- 
1.8.1.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 5/9] MCI: imx-esdhc: Fix possible null pointer dereference
  2013-04-26 16:41 [PATCH 1/9] console: Fix possible null pointer dereference Alexander Shiyan
                   ` (2 preceding siblings ...)
  2013-04-26 16:41 ` [PATCH 4/9] MCI: atmel: Fix possible null pointer dereference Alexander Shiyan
@ 2013-04-26 16:41 ` Alexander Shiyan
  2013-04-26 20:54   ` Sascha Hauer
  2013-04-26 16:41 ` [PATCH 6/9] MCI: imx: " Alexander Shiyan
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Alexander Shiyan @ 2013-04-26 16:41 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/mci/imx-esdhc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index 8c2695c..8194b4d 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -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);
-- 
1.8.1.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 6/9] MCI: imx: Fix possible null pointer dereference
  2013-04-26 16:41 [PATCH 1/9] console: Fix possible null pointer dereference Alexander Shiyan
                   ` (3 preceding siblings ...)
  2013-04-26 16:41 ` [PATCH 5/9] MCI: imx-esdhc: " Alexander Shiyan
@ 2013-04-26 16:41 ` Alexander Shiyan
  2013-04-26 16:41 ` [PATCH 7/9] NAND: imx: Fix memory leak Alexander Shiyan
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Alexander Shiyan @ 2013-04-26 16:41 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 7/9] NAND: imx: Fix memory leak
  2013-04-26 16:41 [PATCH 1/9] console: Fix possible null pointer dereference Alexander Shiyan
                   ` (4 preceding siblings ...)
  2013-04-26 16:41 ` [PATCH 6/9] MCI: imx: " Alexander Shiyan
@ 2013-04-26 16:41 ` Alexander Shiyan
  2013-04-26 16:41 ` [PATCH 8/9] Serial: mpc5xxx: Fix setup mode at port initialization Alexander Shiyan
  2013-04-26 16:41 ` [PATCH 9/9] MCI: imx-esdhc: Remove now unneeded check Alexander Shiyan
  7 siblings, 0 replies; 19+ messages in thread
From: Alexander Shiyan @ 2013-04-26 16:41 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/mtd/nand/nand_imx_bbm.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/nand_imx_bbm.c b/drivers/mtd/nand/nand_imx_bbm.c
index 03961a0..135d74e 100644
--- a/drivers/mtd/nand/nand_imx_bbm.c
+++ b/drivers/mtd/nand/nand_imx_bbm.c
@@ -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);
 }
-- 
1.8.1.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 8/9] Serial: mpc5xxx: Fix setup mode at port initialization
  2013-04-26 16:41 [PATCH 1/9] console: Fix possible null pointer dereference Alexander Shiyan
                   ` (5 preceding siblings ...)
  2013-04-26 16:41 ` [PATCH 7/9] NAND: imx: Fix memory leak Alexander Shiyan
@ 2013-04-26 16:41 ` Alexander Shiyan
  2013-04-30  7:39   ` Sascha Hauer
  2013-04-26 16:41 ` [PATCH 9/9] MCI: imx-esdhc: Remove now unneeded check Alexander Shiyan
  7 siblings, 1 reply; 19+ messages in thread
From: Alexander Shiyan @ 2013-04-26 16:41 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/serial/serial_mpc5xxx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/serial/serial_mpc5xxx.c b/drivers/serial/serial_mpc5xxx.c
index 532eea3..ed77807 100644
--- a/drivers/serial/serial_mpc5xxx.c
+++ b/drivers/serial/serial_mpc5xxx.c
@@ -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;
-- 
1.8.1.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 9/9] MCI: imx-esdhc: Remove now unneeded check
  2013-04-26 16:41 [PATCH 1/9] console: Fix possible null pointer dereference Alexander Shiyan
                   ` (6 preceding siblings ...)
  2013-04-26 16:41 ` [PATCH 8/9] Serial: mpc5xxx: Fix setup mode at port initialization Alexander Shiyan
@ 2013-04-26 16:41 ` Alexander Shiyan
  2013-04-26 20:57   ` Sascha Hauer
  7 siblings, 1 reply; 19+ messages in thread
From: Alexander Shiyan @ 2013-04-26 16:41 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/mci/imx-esdhc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index 8194b4d..8133d2e 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -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 */
-- 
1.8.1.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/9] ARM: at91 smc: Fix possible uninitialized variable
  2013-04-26 16:41 ` [PATCH 3/9] ARM: at91 smc: Fix possible uninitialized variable Alexander Shiyan
@ 2013-04-26 16:59   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-04-26 17:09     ` Re[2]: " Alexander Shiyan
  0 siblings, 1 reply; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-26 16:59 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On 20:41 Fri 26 Apr     , Alexander Shiyan wrote:
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  arch/arm/mach-at91/sam9_smc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/sam9_smc.c b/arch/arm/mach-at91/sam9_smc.c
> index b48275e..a137da4 100644
> --- a/arch/arm/mach-at91/sam9_smc.c
> +++ b/arch/arm/mach-at91/sam9_smc.c
> @@ -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
> -	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;
>  	}
>  
> -- 
> 1.8.1.5
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/9] ARM: at91 gpio: Fix possible null pointer dereference
  2013-04-26 16:41 ` [PATCH 2/9] ARM: at91 gpio: " Alexander Shiyan
@ 2013-04-26 16:59   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-04-26 20:48     ` Sascha Hauer
  0 siblings, 1 reply; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-26 16:59 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On 20:41 Fri 26 Apr     , Alexander Shiyan wrote:
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  arch/arm/mach-at91/gpio.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
> index c2618c7..0e39a52 100644
> --- a/arch/arm/mach-at91/gpio.c
> +++ b/arch/arm/mach-at91/gpio.c
> @@ -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
>  
>  	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;
> -- 
> 1.8.1.5
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re[2]: [PATCH 3/9] ARM: at91 smc: Fix possible uninitialized variable
  2013-04-26 16:59   ` Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-26 17:09     ` Alexander Shiyan
  2013-04-26 20:49       ` Sascha Hauer
  0 siblings, 1 reply; 19+ messages in thread
From: Alexander Shiyan @ 2013-04-26 17:09 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

...
> >  arch/arm/mach-at91/sam9_smc.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/arch/arm/mach-at91/sam9_smc.c b/arch/arm/mach-at91/sam9_smc.c
> > index b48275e..a137da4 100644
> > --- a/arch/arm/mach-at91/sam9_smc.c
> > +++ b/arch/arm/mach-at91/sam9_smc.c
> > @@ -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

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

> > -	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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/9] ARM: at91 gpio: Fix possible null pointer dereference
  2013-04-26 16:59   ` Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-26 20:48     ` Sascha Hauer
  0 siblings, 0 replies; 19+ messages in thread
From: Sascha Hauer @ 2013-04-26 20:48 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Fri, Apr 26, 2013 at 06:59:46PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 20:41 Fri 26 Apr     , Alexander Shiyan wrote:
> > 
> > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> > ---
> >  arch/arm/mach-at91/gpio.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
> > index c2618c7..0e39a52 100644
> > --- a/arch/arm/mach-at91/gpio.c
> > +++ b/arch/arm/mach-at91/gpio.c
> > @@ -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...

> >  
> >  	if (!at91_gpio)
> >  		return -EINVAL;

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

Sascha


-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/9] ARM: at91 smc: Fix possible uninitialized variable
  2013-04-26 17:09     ` Re[2]: " Alexander Shiyan
@ 2013-04-26 20:49       ` Sascha Hauer
  0 siblings, 0 replies; 19+ messages in thread
From: Sascha Hauer @ 2013-04-26 20:49 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On Fri, Apr 26, 2013 at 09:09:16PM +0400, Alexander Shiyan wrote:
> ...
> > >  arch/arm/mach-at91/sam9_smc.c | 8 ++++----
> > >  1 file changed, 4 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/arch/arm/mach-at91/sam9_smc.c b/arch/arm/mach-at91/sam9_smc.c
> > > index b48275e..a137da4 100644
> > > --- a/arch/arm/mach-at91/sam9_smc.c
> > > +++ b/arch/arm/mach-at91/sam9_smc.c
> > > @@ -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
> 
> As far I understand, id can be 0 and 1. In case of dev->id=1, id is not set.
> 
> > > -	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");

Also it fixes the error message.

Sascha

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 5/9] MCI: imx-esdhc: Fix possible null pointer dereference
  2013-04-26 16:41 ` [PATCH 5/9] MCI: imx-esdhc: " Alexander Shiyan
@ 2013-04-26 20:54   ` Sascha Hauer
  2013-04-27  4:45     ` Re[2]: " Alexander Shiyan
  0 siblings, 1 reply; 19+ messages in thread
From: Sascha Hauer @ 2013-04-26 20:54 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On Fri, Apr 26, 2013 at 08:41:10PM +0400, Alexander Shiyan wrote:
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  drivers/mci/imx-esdhc.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
> index 8c2695c..8194b4d 100644
> --- a/drivers/mci/imx-esdhc.c
> +++ b/drivers/mci/imx-esdhc.c
> @@ -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


-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 9/9] MCI: imx-esdhc: Remove now unneeded check
  2013-04-26 16:41 ` [PATCH 9/9] MCI: imx-esdhc: Remove now unneeded check Alexander Shiyan
@ 2013-04-26 20:57   ` Sascha Hauer
  0 siblings, 0 replies; 19+ messages in thread
From: Sascha Hauer @ 2013-04-26 20:57 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On Fri, Apr 26, 2013 at 08:41:14PM +0400, Alexander Shiyan wrote:
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  drivers/mci/imx-esdhc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
> index 8194b4d..8133d2e 100644
> --- a/drivers/mci/imx-esdhc.c
> +++ b/drivers/mci/imx-esdhc.c
> @@ -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


-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re[2]: [PATCH 5/9] MCI: imx-esdhc: Fix possible null pointer dereference
  2013-04-26 20:54   ` Sascha Hauer
@ 2013-04-27  4:45     ` Alexander Shiyan
  0 siblings, 0 replies; 19+ messages in thread
From: Alexander Shiyan @ 2013-04-27  4:45 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

> On Fri, Apr 26, 2013 at 08:41:10PM +0400, Alexander Shiyan wrote:
> > 
> > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> > ---
> >  drivers/mci/imx-esdhc.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
> > index 8c2695c..8194b4d 100644
> > --- a/drivers/mci/imx-esdhc.c
> > +++ b/drivers/mci/imx-esdhc.c
> > @@ -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.

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

---
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 8/9] Serial: mpc5xxx: Fix setup mode at port initialization
  2013-04-26 16:41 ` [PATCH 8/9] Serial: mpc5xxx: Fix setup mode at port initialization Alexander Shiyan
@ 2013-04-30  7:39   ` Sascha Hauer
  2013-04-30  7:46     ` Re[2]: " Alexander Shiyan
  0 siblings, 1 reply; 19+ messages in thread
From: Sascha Hauer @ 2013-04-30  7:39 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On Fri, Apr 26, 2013 at 08:41:13PM +0400, Alexander Shiyan wrote:
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  drivers/serial/serial_mpc5xxx.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/serial/serial_mpc5xxx.c b/drivers/serial/serial_mpc5xxx.c
> index 532eea3..ed77807 100644
> --- a/drivers/serial/serial_mpc5xxx.c
> +++ b/drivers/serial/serial_mpc5xxx.c
> @@ -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;

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

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re[2]: [PATCH 8/9] Serial: mpc5xxx: Fix setup mode at port initialization
  2013-04-30  7:39   ` Sascha Hauer
@ 2013-04-30  7:46     ` Alexander Shiyan
  0 siblings, 0 replies; 19+ messages in thread
From: Alexander Shiyan @ 2013-04-30  7:46 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

> On Fri, Apr 26, 2013 at 08:41:13PM +0400, Alexander Shiyan wrote:
> > 
> > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> > ---
> >  drivers/serial/serial_mpc5xxx.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/serial/serial_mpc5xxx.c b/drivers/serial/serial_mpc5xxx.c
> > index 532eea3..ed77807 100644
> > --- a/drivers/serial/serial_mpc5xxx.c
> > +++ b/drivers/serial/serial_mpc5xxx.c
> > @@ -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;
> 
> 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.

> 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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2013-04-30  7:47 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-26 16:41 [PATCH 1/9] console: Fix possible null pointer dereference Alexander Shiyan
2013-04-26 16:41 ` [PATCH 2/9] ARM: at91 gpio: " Alexander Shiyan
2013-04-26 16:59   ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-26 20:48     ` Sascha Hauer
2013-04-26 16:41 ` [PATCH 3/9] ARM: at91 smc: Fix possible uninitialized variable Alexander Shiyan
2013-04-26 16:59   ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-26 17:09     ` Re[2]: " Alexander Shiyan
2013-04-26 20:49       ` Sascha Hauer
2013-04-26 16:41 ` [PATCH 4/9] MCI: atmel: Fix possible null pointer dereference Alexander Shiyan
2013-04-26 16:41 ` [PATCH 5/9] MCI: imx-esdhc: " Alexander Shiyan
2013-04-26 20:54   ` Sascha Hauer
2013-04-27  4:45     ` Re[2]: " Alexander Shiyan
2013-04-26 16:41 ` [PATCH 6/9] MCI: imx: " Alexander Shiyan
2013-04-26 16:41 ` [PATCH 7/9] NAND: imx: Fix memory leak Alexander Shiyan
2013-04-26 16:41 ` [PATCH 8/9] Serial: mpc5xxx: Fix setup mode at port initialization Alexander Shiyan
2013-04-30  7:39   ` Sascha Hauer
2013-04-30  7:46     ` Re[2]: " Alexander Shiyan
2013-04-26 16:41 ` [PATCH 9/9] MCI: imx-esdhc: Remove now unneeded check Alexander Shiyan
2013-04-26 20:57   ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox