Skip to contentSkip to conversation

mtd: devices: elm: fix elm_context_save() and elm_context_restore() functions

PATCH New Ted Juan 3 participants 4 messages Jun 20, 2014 – Jul 5, 2014 Memory technology devices (MTD)

lore
Share & tools
lore

Ted Juan

author
#0 lore raw

PATCH 1/1 mtd: devices: elm: fix elm_context_save() and elm_context_restore() functions

From: Ted Juan <[email protected]>

These two function's switch case lack the 'break' that make them always return error.

---
 drivers/mtd/devices/elm.c  |    2 ++
 "toreqq\033\033qq\033\033" |   20 ++++++++++++++++++++
 2 files changed, 22 insertions(+)
 create mode 100644 "toreqq\033\033qq\033\033"
drivers/mtd/devices/elm.c +2 -0
index 7df8694..b4f61c7 100644
@@ -475,6 +475,7 @@ static int elm_context_save(struct elm_info *info)
 					ELM_SYNDROME_FRAGMENT_1 + offset);
 			regs->elm_syndrome_fragment_0[i] = elm_read_reg(info,
 					ELM_SYNDROME_FRAGMENT_0 + offset);
+			break;
 		default:
 			return -EINVAL;
 		}
@@ -520,6 +521,7 @@ static int elm_context_restore(struct elm_info *info)
 					regs->elm_syndrome_fragment_1[i]);
 			elm_write_reg(info, ELM_SYNDROME_FRAGMENT_0 + offset,
 					regs->elm_syndrome_fragment_0[i]);
+			break;
 		default:
 			return -EINVAL;
 		}
toreqq\033\033qq\033\033 new file +20 -0
new file mode 100644
index 0000000..4a7b35c
@@ -0,0 +1,20 @@
+diff --git a/drivers/mtd/devices/elm.c b/drivers/mtd/devices/elm.c
+index 7df8694..8e6ba6c 100644
+--- a/drivers/mtd/devices/elm.c
++++ b/drivers/mtd/devices/elm.c
+@@ -475,6 +475,7 @@ static int elm_context_save(struct elm_info *info)
+ 					ELM_SYNDROME_FRAGMENT_1 + offset);
+ 			regs->elm_syndrome_fragment_0[i] = elm_read_reg(info,
+ 					ELM_SYNDROME_FRAGMENT_0 + offset);
++                        break;
+ 		default:
+ 			return -EINVAL;
+ 		}
+@@ -520,6 +521,7 @@ static int elm_context_restore(struct elm_info *info)
+ 					regs->elm_syndrome_fragment_1[i]);
+ 			elm_write_reg(info, ELM_SYNDROME_FRAGMENT_0 + offset,
+ 					regs->elm_syndrome_fragment_0[i]);
++                        break;
+ 		default:
+ 			return -EINVAL;
+ 		}
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/1 mtd: devices: elm: fix elm_context_save() and elm_context_restore() functions

Sorry, last mail has some error. please drop it.

These two function's switch case lack the 'break' that make them always return error.

---
 drivers/mtd/devices/elm.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/mtd/devices/elm.c +2 -0
index 7df8694..b4f61c7 100644
@@ -475,6 +475,7 @@ static int elm_context_save(struct elm_info *info)
 					ELM_SYNDROME_FRAGMENT_1 + offset);
 			regs->elm_syndrome_fragment_0[i] = elm_read_reg(info,
 					ELM_SYNDROME_FRAGMENT_0 + offset);
+			break;
 		default:
 			return -EINVAL;
 		}
@@ -520,6 +521,7 @@ static int elm_context_restore(struct elm_info *info)
 					regs->elm_syndrome_fragment_1[i]);
 			elm_write_reg(info, ELM_SYNDROME_FRAGMENT_0 + offset,
 					regs->elm_syndrome_fragment_0[i]);
+			break;
 		default:
 			return -EINVAL;
 		}
Signature · 1 line
1.7.9.5
Acked-by on v1 1/1
#2 lore raw
Quoted 30 lines

From: Ted Juan [mailto:[email protected]]

These two function's switch case lack the 'break' that make them always return error.

---
drivers/mtd/devices/elm.c | 2 ++

1 file changed, 2 insertions(+)
drivers/mtd/devices/elm.c +2 -1
index 7df8694..b4f61c7 100644
@@ -475,6 +475,7 @@ static int elm_context_save(struct elm_info *info)
 					ELM_SYNDROME_FRAGMENT_1 + offset);
 			regs->elm_syndrome_fragment_0[i] = elm_read_reg(info,
 					ELM_SYNDROME_FRAGMENT_0 + offset);
+			break;
 		default:
 			return -EINVAL;
 		}
@@ -520,6 +521,7 @@ static int elm_context_restore(struct elm_info *info)
 					regs->elm_syndrome_fragment_1[i]);
 			elm_write_reg(info, ELM_SYNDROME_FRAGMENT_0 + offset,
 					regs->elm_syndrome_fragment_0[i]);
+			break;
 		default:
 			return -EINVAL;
 		}
--
Quoted 1 line

1.7.9.5

Thanks for fixing this. Apologies, my bad, I didn't test this nicely. Also, marking it for stable, as it might break transition to low-power modes

with regards, pekon

Applied
#3 lore raw
Quoted 5 lines · Pekon Gupta
Quoted 5 lines

From: Ted Juan [mailto:[email protected]]

These two function's switch case lack the 'break' that make them always return error.

...

Quoted 6 lines

Thanks for fixing this. Apologies, my bad, I didn't test this nicely. Also, marking it for stable, as it might break transition to low-power modes

Pushed to linux-mtd.git, tagged for -stable. I'll try to send this to Linus during the 3.16 cycle.

Thanks for the fix and the review!

Brian