hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/base/regmap/regcache-lzo.c
....@@ -1,14 +1,10 @@
1
-/*
2
- * Register cache access API - LZO caching support
3
- *
4
- * Copyright 2011 Wolfson Microelectronics plc
5
- *
6
- * Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
11
- */
1
+// SPDX-License-Identifier: GPL-2.0
2
+//
3
+// Register cache access API - LZO caching support
4
+//
5
+// Copyright 2011 Wolfson Microelectronics plc
6
+//
7
+// Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
128
139 #include <linux/device.h>
1410 #include <linux/lzo.h>
....@@ -152,20 +148,18 @@
152148 * that register.
153149 */
154150 bmp_size = map->num_reg_defaults_raw;
155
- sync_bmp = kmalloc_array(BITS_TO_LONGS(bmp_size), sizeof(long),
156
- GFP_KERNEL);
151
+ sync_bmp = bitmap_zalloc(bmp_size, GFP_KERNEL);
157152 if (!sync_bmp) {
158153 ret = -ENOMEM;
159154 goto err;
160155 }
161
- bitmap_zero(sync_bmp, bmp_size);
162156
163157 /* allocate the lzo blocks and initialize them */
164158 for (i = 0; i < blkcount; i++) {
165159 lzo_blocks[i] = kzalloc(sizeof **lzo_blocks,
166160 GFP_KERNEL);
167161 if (!lzo_blocks[i]) {
168
- kfree(sync_bmp);
162
+ bitmap_free(sync_bmp);
169163 ret = -ENOMEM;
170164 goto err;
171165 }
....@@ -217,7 +211,7 @@
217211 * only once.
218212 */
219213 if (lzo_blocks[0])
220
- kfree(lzo_blocks[0]->sync_bmp);
214
+ bitmap_free(lzo_blocks[0]->sync_bmp);
221215 for (i = 0; i < blkcount; i++) {
222216 if (lzo_blocks[i]) {
223217 kfree(lzo_blocks[i]->wmem);