mirror of
https://github.com/torvalds/linux.git
synced 2024-12-13 14:43:03 +00:00
net: mscc: ocelot: check return values of writes during reset
The ocelot_reset() function utilizes regmap_field_write() but wasn't checking return values. While this won't cause issues for the current MMIO regmaps, it could be an issue for externally controlled interfaces. Add checks for these return values. Signed-off-by: Colin Foster <colin.foster@in-advantage.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
21bb08cd2c
commit
fa1d90b048
@ -211,8 +211,13 @@ static int ocelot_reset(struct ocelot *ocelot)
|
||||
int err;
|
||||
u32 val;
|
||||
|
||||
regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], 1);
|
||||
regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1);
|
||||
err = regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], 1);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* MEM_INIT is a self-clearing bit. Wait for it to be cleared (should be
|
||||
* 100us) before enabling the switch core.
|
||||
@ -222,10 +227,11 @@ static int ocelot_reset(struct ocelot *ocelot)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1);
|
||||
regmap_field_write(ocelot->regfields[SYS_RESET_CFG_CORE_ENA], 1);
|
||||
err = regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
return regmap_field_write(ocelot->regfields[SYS_RESET_CFG_CORE_ENA], 1);
|
||||
}
|
||||
|
||||
/* Watermark encode
|
||||
|
Loading…
Reference in New Issue
Block a user