diff options
| author | Stephen Warren <swarren@nvidia.com> | 2013-11-25 17:12:47 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@linaro.org> | 2013-11-26 08:16:31 -0500 |
| commit | 6b8e090ecc3dc977fe2eabf6e50bb3870de9ebac (patch) | |
| tree | 135b6df97750ad18ffec09a30c0d8fc902678a52 /drivers | |
| parent | 6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff) | |
regmap: use IS_ERR() to check clk_get() results
clk_get() returns an error pointer, or a valid token to pass back to the
clock API. Hence, the result must be checked with IS_ERR(), not by
comparison against NULL.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/base/regmap/regmap-mmio.c | 11 |
1 files changed, 6 insertions, 5 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; |
