Commit 599eefa0 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'regmap-v3.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap

Pull regmap fixes from Mark Brown:
 "Two small changes to fix some error handling and checking (both of
  which would be quite serious if the errors trigger) plus a trivial
  documentation fix"

* tag 'regmap-v3.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
  regmap: use IS_ERR() to check clk_get() results
  regmap: make sure we unlock on failure in regmap_bulk_write
  regmap: trivial comment fix (copy'n'paste error)
parents 31f984d1 652787ab
...@@ -40,7 +40,7 @@ static int regmap_mmio_gather_write(void *context, ...@@ -40,7 +40,7 @@ static int regmap_mmio_gather_write(void *context,
BUG_ON(reg_size != 4); BUG_ON(reg_size != 4);
if (ctx->clk) { if (!IS_ERR(ctx->clk)) {
ret = clk_enable(ctx->clk); ret = clk_enable(ctx->clk);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -73,7 +73,7 @@ static int regmap_mmio_gather_write(void *context, ...@@ -73,7 +73,7 @@ static int regmap_mmio_gather_write(void *context,
offset += ctx->val_bytes; offset += ctx->val_bytes;
} }
if (ctx->clk) if (!IS_ERR(ctx->clk))
clk_disable(ctx->clk); clk_disable(ctx->clk);
return 0; return 0;
...@@ -96,7 +96,7 @@ static int regmap_mmio_read(void *context, ...@@ -96,7 +96,7 @@ static int regmap_mmio_read(void *context,
BUG_ON(reg_size != 4); BUG_ON(reg_size != 4);
if (ctx->clk) { if (!IS_ERR(ctx->clk)) {
ret = clk_enable(ctx->clk); ret = clk_enable(ctx->clk);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -129,7 +129,7 @@ static int regmap_mmio_read(void *context, ...@@ -129,7 +129,7 @@ static int regmap_mmio_read(void *context,
offset += ctx->val_bytes; offset += ctx->val_bytes;
} }
if (ctx->clk) if (!IS_ERR(ctx->clk))
clk_disable(ctx->clk); clk_disable(ctx->clk);
return 0; return 0;
...@@ -139,7 +139,7 @@ static void regmap_mmio_free_context(void *context) ...@@ -139,7 +139,7 @@ static void regmap_mmio_free_context(void *context)
{ {
struct regmap_mmio_context *ctx = context; struct regmap_mmio_context *ctx = context;
if (ctx->clk) { if (!IS_ERR(ctx->clk)) {
clk_unprepare(ctx->clk); clk_unprepare(ctx->clk);
clk_put(ctx->clk); clk_put(ctx->clk);
} }
...@@ -209,6 +209,7 @@ static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev, ...@@ -209,6 +209,7 @@ static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev,
ctx->regs = regs; ctx->regs = regs;
ctx->val_bytes = config->val_bits / 8; ctx->val_bytes = config->val_bits / 8;
ctx->clk = ERR_PTR(-ENODEV);
if (clk_id == NULL) if (clk_id == NULL)
return ctx; return ctx;
......
...@@ -1549,7 +1549,7 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, ...@@ -1549,7 +1549,7 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
val + (i * val_bytes), val + (i * val_bytes),
val_bytes); val_bytes);
if (ret != 0) if (ret != 0)
return ret; goto out;
} }
} else { } else {
ret = _regmap_raw_write(map, reg, wval, val_bytes * val_count); 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,7 +1743,7 @@ static int _regmap_read(struct regmap *map, unsigned int reg,
/** /**
* regmap_read(): Read a value from a single register * regmap_read(): Read a value from a single register
* *
* @map: Register map to write to * @map: Register map to read from
* @reg: Register to be read from * @reg: Register to be read from
* @val: Pointer to store read value * @val: Pointer to store read value
* *
...@@ -1770,7 +1770,7 @@ EXPORT_SYMBOL_GPL(regmap_read); ...@@ -1770,7 +1770,7 @@ EXPORT_SYMBOL_GPL(regmap_read);
/** /**
* regmap_raw_read(): Read raw data from the device * regmap_raw_read(): Read raw data from the device
* *
* @map: Register map to write to * @map: Register map to read from
* @reg: First register to be read from * @reg: First register to be read from
* @val: Pointer to store read value * @val: Pointer to store read value
* @val_len: Size of data to read * @val_len: Size of data to read
...@@ -1882,7 +1882,7 @@ EXPORT_SYMBOL_GPL(regmap_fields_read); ...@@ -1882,7 +1882,7 @@ EXPORT_SYMBOL_GPL(regmap_fields_read);
/** /**
* regmap_bulk_read(): Read multiple registers from the device * regmap_bulk_read(): Read multiple registers from the device
* *
* @map: Register map to write to * @map: Register map to read from
* @reg: First register to be read from * @reg: First register to be read from
* @val: Pointer to store read value, in native register size for device * @val: Pointer to store read value, in native register size for device
* @val_count: Number of registers to read * @val_count: Number of registers to read
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment