Skip to contentSkip to conversation

memory: stm32_omm: initialize ret in stm32_omm_set_amcr

PATCH Applied Ruoyu Wang 3 participants 3 messages Jun 17 – Jun 30

Subsystems (3)
lore
Share & tools
lore

Ruoyu Wang

author
#0 lore raw

PATCH 1/1 memory: stm32_omm: initialize ret in stm32_omm_set_amcr

stm32_omm_set_amcr() returns ret after checking whether the AMCR value matches the device tree description. On the normal matching path ret is not otherwise assigned, so initialize it to 0 before the checks.

---
 drivers/memory/stm32_omm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/memory/stm32_omm.c +1 -1
index 5d06623f3f689..2a1af229d2444 100644
@@ -47,7 +47,7 @@ static int stm32_omm_set_amcr(struct device *dev, bool set)
 	struct device_node *node;
 	struct resource res, res1;
 	unsigned int syscon_args[2];
-	int ret, idx;
+	int ret = 0, idx;
 	unsigned int i, amcr, read_amcr;
 
 	for (i = 0; i < omm->nb_child; i++) {
Signature · 1 line
2.51.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Ruoyu Wang

stm32_omm_set_amcr() returns ret after checking whether the AMCR value matches the device tree description. On the normal matching path ret is not otherwise assigned, so initialize it to 0 before the checks.

---
 drivers/memory/stm32_omm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/memory/stm32_omm.c +0 -0
index 5d06623f3f689..2a1af229d2444 100644

drivers/memory/stm32_omm.c static int stm32_omm_set_amcr(struct device *dev, bool set) · line 53

Quoted 8 lines
drivers/memory/stm32_omm.c +1 -1
@@ -47,7 +47,7 @@ static int stm32_omm_set_amcr(struct device *dev, bool set)
 	struct device_node *node;
 	struct resource res, res1;
 	unsigned int syscon_args[2];
-	int ret, idx;
+	int ret = 0, idx;
 	unsigned int i, amcr, read_amcr;
 
 	for (i = 0; i < omm->nb_child; i++) {

Hi Ruoyu

Thanks
Patrice

maintainer Applied
#2 lore raw
In reply to Ruoyu Wang
Quoted 3 lines · Ruoyu Wang

stm32_omm_set_amcr() returns ret after checking whether the AMCR value matches the device tree description. On the normal matching path ret is not otherwise assigned, so initialize it to 0 before the checks.

Applied, thanks!

[1/1] memory: stm32_omm: initialize ret in stm32_omm_set_amcr

      https://git.kernel.org/krzk/linux-mem-ctrl/c/1527acf2295cf2d6e11e3e9b121d63709667e6e7

Best regards,

Signature · 1 line
Krzysztof Kozlowski <[email protected]>