Skip to contentSkip to conversation

regmap: mdio: Don't modify output if error happened

PATCH In review Andy Shevchenko 2 participants 2 messages May 20, 2021

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

PATCH 1/1 regmap: mdio: Don't modify output if error happened

regmap_mdio_read() breaks the principle of "no touch output till it's known that the operation succeeds". Refactor it accordingly.

---
 drivers/base/regmap/regmap-mdio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/base/regmap/regmap-mdio.c +4 -2
index 5f18fe409f56..5ec208279913 100644
@@ -11,9 +11,11 @@ static int regmap_mdio_read(void *context, unsigned int reg, unsigned int *val)
 	int ret;
 
 	ret = mdiobus_read(mdio_dev->bus, mdio_dev->addr, reg);
-	*val = ret & 0xffff;
+	if (ret < 0)
+		return ret;
 
-	return ret < 0 ? ret : 0;
+	*val = ret & 0xffff;
+	return 0;
 }
 
 static int regmap_mdio_write(void *context, unsigned int reg, unsigned int val)
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 2 lines · Andy Shevchenko

regmap_mdio_read() breaks the principle of "no touch output till it's known that the operation succeeds". Refactor it accordingly.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next

Thanks!

[1/1] regmap: mdio: Don't modify output if error happened

      commit: e56360d6a119f531506658ea87238e48ad4c95c2

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark