diff mbox series

mt76: eeprom: tolerate corrected bit-flips

Message ID YZ/XvfwzqUyjmBCm@makrotopia.org (mailing list archive)
State Superseded
Delegated to: Felix Fietkau
Headers show
Series mt76: eeprom: tolerate corrected bit-flips | expand

Commit Message

Daniel Golle Nov. 25, 2021, 6:36 p.m. UTC
mtd_read() returns -EUCLEAN in case of corrected bit-flips.
As data was read, don't error out in this case.

Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 drivers/net/wireless/mediatek/mt76/eeprom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Golle Nov. 25, 2021, 7:43 p.m. UTC | #1
On Thu, Nov 25, 2021 at 07:44:26PM +0100, Felix Fietkau wrote:
> 
> On 2021-11-25 19:36, Daniel Golle wrote:
> > mtd_read() returns -EUCLEAN in case of corrected bit-flips.
> > As data was read, don't error out in this case.
> > 
> > Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
> > Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> > ---
> >   drivers/net/wireless/mediatek/mt76/eeprom.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c
> > index 2d58aa31db934..0eb98f7ff7ec0 100644
> > --- a/drivers/net/wireless/mediatek/mt76/eeprom.c
> > +++ b/drivers/net/wireless/mediatek/mt76/eeprom.c
> > @@ -65,7 +65,7 @@ int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int offset, int len)
> >   	offset = be32_to_cpup(list);
> >   	ret = mtd_read(mtd, offset, len, &retlen, eep);
> >   	put_mtd_device(mtd);
> > -	if (ret) {
> > +	if (ret && !mtd_is_bitflip(err)) {
> I don't think this will even compile (err vs ret)

Oops, that has sneaked in when making use of the macro last minute.
I'll send v2.
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c
index 2d58aa31db934..0eb98f7ff7ec0 100644
--- a/drivers/net/wireless/mediatek/mt76/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/eeprom.c
@@ -65,7 +65,7 @@  int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int offset, int len)
 	offset = be32_to_cpup(list);
 	ret = mtd_read(mtd, offset, len, &retlen, eep);
 	put_mtd_device(mtd);
-	if (ret) {
+	if (ret && !mtd_is_bitflip(err)) {
 		dev_err(dev->dev, "reading EEPROM from mtd %s failed: %i\n",
 			part, ret);
 		goto out_put_node;