| .. | .. | 
|---|
| 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> | 
|---|
| 12 | 8 |  | 
|---|
| 13 | 9 | #include <linux/device.h> | 
|---|
| 14 | 10 | #include <linux/lzo.h> | 
|---|
| .. | .. | 
|---|
| 152 | 148 | * that register. | 
|---|
| 153 | 149 | */ | 
|---|
| 154 | 150 | 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); | 
|---|
| 157 | 152 | if (!sync_bmp) { | 
|---|
| 158 | 153 | ret = -ENOMEM; | 
|---|
| 159 | 154 | goto err; | 
|---|
| 160 | 155 | } | 
|---|
| 161 |  | -	bitmap_zero(sync_bmp, bmp_size); | 
|---|
| 162 | 156 |  | 
|---|
| 163 | 157 | /* allocate the lzo blocks and initialize them */ | 
|---|
| 164 | 158 | for (i = 0; i < blkcount; i++) { | 
|---|
| 165 | 159 | lzo_blocks[i] = kzalloc(sizeof **lzo_blocks, | 
|---|
| 166 | 160 | GFP_KERNEL); | 
|---|
| 167 | 161 | if (!lzo_blocks[i]) { | 
|---|
| 168 |  | -			kfree(sync_bmp); | 
|---|
|  | 162 | +			bitmap_free(sync_bmp); | 
|---|
| 169 | 163 | ret = -ENOMEM; | 
|---|
| 170 | 164 | goto err; | 
|---|
| 171 | 165 | } | 
|---|
| .. | .. | 
|---|
| 217 | 211 | * only once. | 
|---|
| 218 | 212 | */ | 
|---|
| 219 | 213 | if (lzo_blocks[0]) | 
|---|
| 220 |  | -		kfree(lzo_blocks[0]->sync_bmp); | 
|---|
|  | 214 | +		bitmap_free(lzo_blocks[0]->sync_bmp); | 
|---|
| 221 | 215 | for (i = 0; i < blkcount; i++) { | 
|---|
| 222 | 216 | if (lzo_blocks[i]) { | 
|---|
| 223 | 217 | kfree(lzo_blocks[i]->wmem); | 
|---|