mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 0/4] random fixes
@ 2018-11-16 10:10 Oleksij Rempel
  2018-11-16 10:10 ` [PATCH v2 1/4] ddr_spd: remove unused array Oleksij Rempel
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Oleksij Rempel @ 2018-11-16 10:10 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel

Some random fixes for issues found by https://app.codacy.com

Oleksij Rempel (4):
  ddr_spd: remove unused array
  video/ssd1307fb: fix potential memory leak on error
  clk: imx: cpu: avoid use after free on error
  of: partition: set ret for error cases

 common/ddr_spd.c          | 2 --
 drivers/clk/imx/clk-cpu.c | 4 +++-
 drivers/of/partition.c    | 4 ++--
 drivers/video/ssd1307fb.c | 7 +++++--
 4 files changed, 10 insertions(+), 7 deletions(-)

-- 
2.17.1


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

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

* [PATCH v2 1/4] ddr_spd: remove unused array
  2018-11-16 10:10 [PATCH v2 0/4] random fixes Oleksij Rempel
@ 2018-11-16 10:10 ` Oleksij Rempel
  2018-11-16 10:10 ` [PATCH v2 2/4] video/ssd1307fb: fix potential memory leak on error Oleksij Rempel
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Oleksij Rempel @ 2018-11-16 10:10 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 common/ddr_spd.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/common/ddr_spd.c b/common/ddr_spd.c
index ec343ef5a..7e2945ed9 100644
--- a/common/ddr_spd.c
+++ b/common/ddr_spd.c
@@ -166,7 +166,6 @@ static int ddr2_sdram_ctime(uint8_t byte)
 void ddr_spd_print(uint8_t *record)
 {
 	int highestCAS = 0;
-	int cas[256];
 	int i, i_i, k, x, y;
 	int ddrclk, tbits, pcclk;
 	int trcd, trp, tras;
@@ -199,7 +198,6 @@ void ddr_spd_print(uint8_t *record)
 	for (i_i = 2; i_i < 7; i_i++) {
 		if (s->cas_lat & 1 << i_i) {
 			highestCAS = i_i;
-			cas[highestCAS]++;
 		}
 	}
 
-- 
2.17.1


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

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

* [PATCH v2 2/4] video/ssd1307fb: fix potential memory leak on error
  2018-11-16 10:10 [PATCH v2 0/4] random fixes Oleksij Rempel
  2018-11-16 10:10 ` [PATCH v2 1/4] ddr_spd: remove unused array Oleksij Rempel
@ 2018-11-16 10:10 ` Oleksij Rempel
  2018-11-16 10:10 ` [PATCH v2 3/4] clk: imx: cpu: avoid use after free " Oleksij Rempel
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Oleksij Rempel @ 2018-11-16 10:10 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 drivers/video/ssd1307fb.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/video/ssd1307fb.c b/drivers/video/ssd1307fb.c
index d68f0c505..70077e43a 100644
--- a/drivers/video/ssd1307fb.c
+++ b/drivers/video/ssd1307fb.c
@@ -548,8 +548,10 @@ static int ssd1307fb_probe(struct device_d *dev)
 	/* clear display */
 	array = ssd1307fb_alloc_array(par->width * par->height / 8,
 				      SSD1307FB_DATA);
-	if (!array)
-		return -ENOMEM;
+	if (!array) {
+		ret = -ENOMEM;
+		goto panel_init_error;
+	}
 
 	for (i = 0; i < (par->height / 8); i++) {
 		for (j = 0; j < par->width; j++) {
@@ -569,6 +571,7 @@ static int ssd1307fb_probe(struct device_d *dev)
 
 panel_init_error:
 reset_oled_error:
+	free(vmem);
 fb_alloc_error:
 	regulator_disable(par->vbat);
 	free(info);
-- 
2.17.1


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

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

* [PATCH v2 3/4] clk: imx: cpu: avoid use after free on error
  2018-11-16 10:10 [PATCH v2 0/4] random fixes Oleksij Rempel
  2018-11-16 10:10 ` [PATCH v2 1/4] ddr_spd: remove unused array Oleksij Rempel
  2018-11-16 10:10 ` [PATCH v2 2/4] video/ssd1307fb: fix potential memory leak on error Oleksij Rempel
@ 2018-11-16 10:10 ` Oleksij Rempel
  2018-11-16 10:10 ` [PATCH v2 4/4] of: partition: set ret for error cases Oleksij Rempel
  2018-11-19  8:10 ` [PATCH v2 0/4] random fixes Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Oleksij Rempel @ 2018-11-16 10:10 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 drivers/clk/imx/clk-cpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-cpu.c b/drivers/clk/imx/clk-cpu.c
index 5ac0ed178..473500131 100644
--- a/drivers/clk/imx/clk-cpu.c
+++ b/drivers/clk/imx/clk-cpu.c
@@ -111,8 +111,10 @@ struct clk *imx_clk_cpu(const char *name, const char *parent_name,
 	cpu->clk.num_parents = 1;
 
 	ret = clk_register(&cpu->clk);
-	if (ret)
+	if (ret) {
 		free(cpu);
+		return NULL;
+	}
 
 	return &cpu->clk;
 }
-- 
2.17.1


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

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

* [PATCH v2 4/4] of: partition: set ret for error cases
  2018-11-16 10:10 [PATCH v2 0/4] random fixes Oleksij Rempel
                   ` (2 preceding siblings ...)
  2018-11-16 10:10 ` [PATCH v2 3/4] clk: imx: cpu: avoid use after free " Oleksij Rempel
@ 2018-11-16 10:10 ` Oleksij Rempel
  2018-11-19  8:10 ` [PATCH v2 0/4] random fixes Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Oleksij Rempel @ 2018-11-16 10:10 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel

looks like it was forgotten.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 drivers/of/partition.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/of/partition.c b/drivers/of/partition.c
index aa6e601b7..2848b9636 100644
--- a/drivers/of/partition.c
+++ b/drivers/of/partition.c
@@ -186,11 +186,11 @@ static int of_partition_fixup(struct device_node *root, void *ctx)
 			return ret;
 	}
 
-	of_property_write_u32(partnode, "#size-cells", n_cells);
+	ret = of_property_write_u32(partnode, "#size-cells", n_cells);
 	if (ret)
 		return ret;
 
-	of_property_write_u32(partnode, "#address-cells", n_cells);
+	ret = of_property_write_u32(partnode, "#address-cells", n_cells);
 	if (ret)
 		return ret;
 
-- 
2.17.1


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

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

* Re: [PATCH v2 0/4] random fixes
  2018-11-16 10:10 [PATCH v2 0/4] random fixes Oleksij Rempel
                   ` (3 preceding siblings ...)
  2018-11-16 10:10 ` [PATCH v2 4/4] of: partition: set ret for error cases Oleksij Rempel
@ 2018-11-19  8:10 ` Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2018-11-19  8:10 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: barebox

On Fri, Nov 16, 2018 at 11:10:28AM +0100, Oleksij Rempel wrote:
> Some random fixes for issues found by https://app.codacy.com
> 
> Oleksij Rempel (4):
>   ddr_spd: remove unused array
>   video/ssd1307fb: fix potential memory leak on error
>   clk: imx: cpu: avoid use after free on error
>   of: partition: set ret for error cases
> 
>  common/ddr_spd.c          | 2 --
>  drivers/clk/imx/clk-cpu.c | 4 +++-
>  drivers/of/partition.c    | 4 ++--
>  drivers/video/ssd1307fb.c | 7 +++++--
>  4 files changed, 10 insertions(+), 7 deletions(-)

Applied, thanks

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] 6+ messages in thread

end of thread, other threads:[~2018-11-19  8:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-16 10:10 [PATCH v2 0/4] random fixes Oleksij Rempel
2018-11-16 10:10 ` [PATCH v2 1/4] ddr_spd: remove unused array Oleksij Rempel
2018-11-16 10:10 ` [PATCH v2 2/4] video/ssd1307fb: fix potential memory leak on error Oleksij Rempel
2018-11-16 10:10 ` [PATCH v2 3/4] clk: imx: cpu: avoid use after free " Oleksij Rempel
2018-11-16 10:10 ` [PATCH v2 4/4] of: partition: set ret for error cases Oleksij Rempel
2018-11-19  8:10 ` [PATCH v2 0/4] random fixes Sascha Hauer

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