From f7d01359b0d96331fce7bd4051d3b68a4bb5ea83 Mon Sep 17 00:00:00 2001 From: Lucas Tanure Date: Thu, 12 Nov 2020 15:02:17 +0000 Subject: regmap: Fix order of regmap write log _regmap_write can trigger a _regmap_select_page, which will call another _regmap_write that will be executed first, but the log shows the inverse order Also, keep consistency with _regmap_read which only logs in case of success Signed-off-by: Lucas Tanure Reviewed-by: Charles Keepax Link: https://lore.kernel.org/r/20201112150217.459844-1-tanureal@opensource.cirrus.com Signed-off-by: Mark Brown --- drivers/base/regmap/regmap.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'drivers/base/regmap') diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 5db536ccfcd6..297e95be25b3 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1924,12 +1924,15 @@ int _regmap_write(struct regmap *map, unsigned int reg, } } - if (regmap_should_log(map)) - dev_info(map->dev, "%x <= %x\n", reg, val); + ret = map->reg_write(context, reg, val); + if (ret == 0) { + if (regmap_should_log(map)) + dev_info(map->dev, "%x <= %x\n", reg, val); - trace_regmap_reg_write(map, reg, val); + trace_regmap_reg_write(map, reg, val); + } - return map->reg_write(context, reg, val); + return ret; } /** -- cgit v1.2.3