diff options
| -rw-r--r-- | drivers/base/regmap/regmap-debugfs.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index e8d15db2f126..9099cd33fbcb 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c | |||
| @@ -56,6 +56,19 @@ static const struct file_operations regmap_name_fops = { | |||
| 56 | .llseek = default_llseek, | 56 | .llseek = default_llseek, |
| 57 | }; | 57 | }; |
| 58 | 58 | ||
| 59 | static void regmap_debugfs_free_dump_cache(struct regmap *map) | ||
| 60 | { | ||
| 61 | struct regmap_debugfs_off_cache *c; | ||
| 62 | |||
| 63 | while (!list_empty(&map->debugfs_off_cache)) { | ||
| 64 | c = list_first_entry(&map->debugfs_off_cache, | ||
| 65 | struct regmap_debugfs_off_cache, | ||
| 66 | list); | ||
| 67 | list_del(&c->list); | ||
| 68 | kfree(c); | ||
| 69 | } | ||
| 70 | } | ||
| 71 | |||
| 59 | /* | 72 | /* |
| 60 | * Work out where the start offset maps into register numbers, bearing | 73 | * Work out where the start offset maps into register numbers, bearing |
| 61 | * in mind that we suppress hidden registers. | 74 | * in mind that we suppress hidden registers. |
| @@ -91,8 +104,10 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map, | |||
| 91 | /* No cache entry? Start a new one */ | 104 | /* No cache entry? Start a new one */ |
| 92 | if (!c) { | 105 | if (!c) { |
| 93 | c = kzalloc(sizeof(*c), GFP_KERNEL); | 106 | c = kzalloc(sizeof(*c), GFP_KERNEL); |
| 94 | if (!c) | 107 | if (!c) { |
| 95 | break; | 108 | regmap_debugfs_free_dump_cache(map); |
| 109 | return base; | ||
| 110 | } | ||
| 96 | c->min = p; | 111 | c->min = p; |
| 97 | c->base_reg = i; | 112 | c->base_reg = i; |
| 98 | } | 113 | } |
| @@ -388,16 +403,8 @@ void regmap_debugfs_init(struct regmap *map, const char *name) | |||
| 388 | 403 | ||
| 389 | void regmap_debugfs_exit(struct regmap *map) | 404 | void regmap_debugfs_exit(struct regmap *map) |
| 390 | { | 405 | { |
| 391 | struct regmap_debugfs_off_cache *c; | ||
| 392 | |||
| 393 | debugfs_remove_recursive(map->debugfs); | 406 | debugfs_remove_recursive(map->debugfs); |
| 394 | while (!list_empty(&map->debugfs_off_cache)) { | 407 | regmap_debugfs_free_dump_cache(map); |
| 395 | c = list_first_entry(&map->debugfs_off_cache, | ||
| 396 | struct regmap_debugfs_off_cache, | ||
| 397 | list); | ||
| 398 | list_del(&c->list); | ||
| 399 | kfree(c); | ||
| 400 | } | ||
| 401 | kfree(map->debugfs_name); | 408 | kfree(map->debugfs_name); |
| 402 | } | 409 | } |
| 403 | 410 | ||
