Skip to contentSkip to conversation

random fixes

PATCH Applied Oleksij Rempel 2 participants 6 messages Nov 16, 2018 – Nov 19, 2018

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

v2 cover random fixes

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(-)
Signature · 7 lines
2.17.1


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

PATCH v2 1/4 ddr_spd: remove unused array

---
 common/ddr_spd.c | 2 --
 1 file changed, 2 deletions(-)
common/ddr_spd.c +0 -2
index ec343ef5a..7e2945ed9 100644
@@ -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]++;
 		}
 	}
 
Signature · 7 lines
2.17.1


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

PATCH v2 2/4 video/ssd1307fb: fix potential memory leak on error

In reply to Oleksij Rempel
---
 drivers/video/ssd1307fb.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/video/ssd1307fb.c +5 -2
index d68f0c505..70077e43a 100644
@@ -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);
Signature · 7 lines
2.17.1


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

PATCH v2 3/4 clk: imx: cpu: avoid use after free on error

In reply to Oleksij Rempel
---
 drivers/clk/imx/clk-cpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/imx/clk-cpu.c +3 -1
index 5ac0ed178..473500131 100644
@@ -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;
 }
Signature · 7 lines
2.17.1


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

PATCH v2 4/4 of: partition: set ret for error cases

In reply to Oleksij Rempel

looks like it was forgotten.

---
 drivers/of/partition.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/of/partition.c +2 -2
index aa6e601b7..2848b9636 100644
@@ -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;
 
Signature · 7 lines
2.17.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer Applied
#5 lore raw
In reply to Oleksij Rempel
Quoted 8 lines · 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

Quoted 5 lines
 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

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