regmap: Fix work_buf switching for page update during virtual range access.
authorKrystian Garbaciak <krystian.garbaciak@diasemi.com>
Mon, 18 Jun 2012 12:04:29 +0000 (13:04 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 19 Jun 2012 09:42:56 +0000 (10:42 +0100)
After page update, orginal work_buf has to be restored regardless of
the result.

Signed-off-by: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/base/regmap/regmap.c

index 83a0166420a40f9cb6ca0083ddec21be901ce64e..d912eb2d19cec9687655759e98003b25865dff28 100644 (file)
@@ -693,10 +693,11 @@ static int _regmap_select_page(struct regmap *map, unsigned int *reg,
                                        range->selector_mask,
                                        win_page << range->selector_shift,
                                        &page_chg);
-                       if (ret < 0)
-                               return ret;
 
                        map->work_buf = orig_work_buf;
+
+                       if (ret < 0)
+                               return ret;
                }
 
                *reg = range->window_start + win_offset;