lkml.org 
[lkml]   [2011]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 7/8] regmap: It is impossible to be given a NULL defaults cache
    Date
    In the new regcache API, it is impossible to hand a NULL defaults
    cache to any of the cache compression types.

    Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
    ---
    drivers/base/regmap/regcache-lzo.c | 30 +++---------------------------
    1 files changed, 3 insertions(+), 27 deletions(-)

    diff --git a/drivers/base/regmap/regcache-lzo.c b/drivers/base/regmap/regcache-lzo.c
    index 9e0d7be..18e1a8c 100644
    --- a/drivers/base/regmap/regcache-lzo.c
    +++ b/drivers/base/regmap/regcache-lzo.c
    @@ -125,32 +125,17 @@ static int regcache_lzo_init(struct regmap *map)
    {
    struct regcache_lzo_ctx **lzo_blocks;
    size_t bmp_size;
    - int ret, tofree, i, blksize, blkcount;
    + int ret, i, blksize, blkcount;
    const char *p, *end;
    unsigned long *sync_bmp;

    ret = 0;

    - /*
    - * If we have not been given a default register cache
    - * then allocate a dummy zero-ed out region, compress it
    - * and remember to free it afterwards.
    - */
    - tofree = 0;
    - if (!map->cache_defaults_raw) {
    - map->cache_defaults_raw = kzalloc(map->cache_size_raw, GFP_KERNEL);
    - if (!map->cache_defaults_raw)
    - return -ENOMEM;
    - tofree = 1;
    - }
    -
    blkcount = regcache_lzo_block_count();
    map->cache = kzalloc(blkcount * sizeof *lzo_blocks,
    GFP_KERNEL);
    - if (!map->cache) {
    - ret = -ENOMEM;
    - goto err_tofree;
    - }
    + if (!map->cache)
    + return -ENOMEM;
    lzo_blocks = map->cache;

    /*
    @@ -203,18 +188,9 @@ static int regcache_lzo_init(struct regmap *map)
    lzo_blocks[i]->src_len;
    }

    - if (tofree) {
    - kfree(map->cache_defaults_raw);
    - map->cache_defaults_raw = NULL;
    - }
    return 0;
    err:
    regcache_exit(map);
    -err_tofree:
    - if (tofree) {
    - kfree(map->cache_defaults_raw);
    - map->cache_defaults_raw = NULL;
    - }
    return ret;
    }

    --
    1.7.6.1


    \
     
     \ /
      Last update: 2011-09-02 17:49    [W:4.114 / U:0.076 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site