diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/regmap/regmap-mmio.c | 11 | ||||
-rw-r--r-- | drivers/base/regmap/regmap.c | 8 |
2 files changed, 10 insertions, 9 deletions
diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c index 98745dd77e8c..81f977510775 100644 --- a/drivers/base/regmap/regmap-mmio.c +++ b/drivers/base/regmap/regmap-mmio.c | |||
@@ -40,7 +40,7 @@ static int regmap_mmio_gather_write(void *context, | |||
40 | 40 | ||
41 | BUG_ON(reg_size != 4); | 41 | BUG_ON(reg_size != 4); |
42 | 42 | ||
43 | if (ctx->clk) { | 43 | if (!IS_ERR(ctx->clk)) { |
44 | ret = clk_enable(ctx->clk); | 44 | ret = clk_enable(ctx->clk); |
45 | if (ret < 0) | 45 | if (ret < 0) |
46 | return ret; | 46 | return ret; |
@@ -73,7 +73,7 @@ static int regmap_mmio_gather_write(void *context, | |||
73 | offset += ctx->val_bytes; | 73 | offset += ctx->val_bytes; |
74 | } | 74 | } |
75 | 75 | ||
76 | if (ctx->clk) | 76 | if (!IS_ERR(ctx->clk)) |
77 | clk_disable(ctx->clk); | 77 | clk_disable(ctx->clk); |
78 | 78 | ||
79 | return 0; | 79 | return 0; |
@@ -96,7 +96,7 @@ static int regmap_mmio_read(void *context, | |||
96 | 96 | ||
97 | BUG_ON(reg_size != 4); | 97 | BUG_ON(reg_size != 4); |
98 | 98 | ||
99 | if (ctx->clk) { | 99 | if (!IS_ERR(ctx->clk)) { |
100 | ret = clk_enable(ctx->clk); | 100 | ret = clk_enable(ctx->clk); |
101 | if (ret < 0) | 101 | if (ret < 0) |
102 | return ret; | 102 | return ret; |
@@ -129,7 +129,7 @@ static int regmap_mmio_read(void *context, | |||
129 | offset += ctx->val_bytes; | 129 | offset += ctx->val_bytes; |
130 | } | 130 | } |
131 | 131 | ||
132 | if (ctx->clk) | 132 | if (!IS_ERR(ctx->clk)) |
133 | clk_disable(ctx->clk); | 133 | clk_disable(ctx->clk); |
134 | 134 | ||
135 | return 0; | 135 | return 0; |
@@ -139,7 +139,7 @@ static void regmap_mmio_free_context(void *context) | |||
139 | { | 139 | { |
140 | struct regmap_mmio_context *ctx = context; | 140 | struct regmap_mmio_context *ctx = context; |
141 | 141 | ||
142 | if (ctx->clk) { | 142 | if (!IS_ERR(ctx->clk)) { |
143 | clk_unprepare(ctx->clk); | 143 | clk_unprepare(ctx->clk); |
144 | clk_put(ctx->clk); | 144 | clk_put(ctx->clk); |
145 | } | 145 | } |
@@ -209,6 +209,7 @@ static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev, | |||
209 | 209 | ||
210 | ctx->regs = regs; | 210 | ctx->regs = regs; |
211 | ctx->val_bytes = config->val_bits / 8; | 211 | ctx->val_bytes = config->val_bits / 8; |
212 | ctx->clk = ERR_PTR(-ENODEV); | ||
212 | 213 | ||
213 | if (clk_id == NULL) | 214 | if (clk_id == NULL) |
214 | return ctx; | 215 | return ctx; |
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 9c021d9cace0..c2e002100949 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
@@ -1549,7 +1549,7 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, | |||
1549 | val + (i * val_bytes), | 1549 | val + (i * val_bytes), |
1550 | val_bytes); | 1550 | val_bytes); |
1551 | if (ret != 0) | 1551 | if (ret != 0) |
1552 | return ret; | 1552 | goto out; |
1553 | } | 1553 | } |
1554 | } else { | 1554 | } else { |
1555 | ret = _regmap_raw_write(map, reg, wval, val_bytes * val_count); | 1555 | ret = _regmap_raw_write(map, reg, wval, val_bytes * val_count); |
@@ -1743,7 +1743,7 @@ static int _regmap_read(struct regmap *map, unsigned int reg, | |||
1743 | /** | 1743 | /** |
1744 | * regmap_read(): Read a value from a single register | 1744 | * regmap_read(): Read a value from a single register |
1745 | * | 1745 | * |
1746 | * @map: Register map to write to | 1746 | * @map: Register map to read from |
1747 | * @reg: Register to be read from | 1747 | * @reg: Register to be read from |
1748 | * @val: Pointer to store read value | 1748 | * @val: Pointer to store read value |
1749 | * | 1749 | * |
@@ -1770,7 +1770,7 @@ EXPORT_SYMBOL_GPL(regmap_read); | |||
1770 | /** | 1770 | /** |
1771 | * regmap_raw_read(): Read raw data from the device | 1771 | * regmap_raw_read(): Read raw data from the device |
1772 | * | 1772 | * |
1773 | * @map: Register map to write to | 1773 | * @map: Register map to read from |
1774 | * @reg: First register to be read from | 1774 | * @reg: First register to be read from |
1775 | * @val: Pointer to store read value | 1775 | * @val: Pointer to store read value |
1776 | * @val_len: Size of data to read | 1776 | * @val_len: Size of data to read |
@@ -1882,7 +1882,7 @@ EXPORT_SYMBOL_GPL(regmap_fields_read); | |||
1882 | /** | 1882 | /** |
1883 | * regmap_bulk_read(): Read multiple registers from the device | 1883 | * regmap_bulk_read(): Read multiple registers from the device |
1884 | * | 1884 | * |
1885 | * @map: Register map to write to | 1885 | * @map: Register map to read from |
1886 | * @reg: First register to be read from | 1886 | * @reg: First register to be read from |
1887 | * @val: Pointer to store read value, in native register size for device | 1887 | * @val: Pointer to store read value, in native register size for device |
1888 | * @val_count: Number of registers to read | 1888 | * @val_count: Number of registers to read |