Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: htc-pasic3: Convert to managed resources for allocating memory

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

authored by

Lee Jones and committed by
Samuel Ortiz
8692881e 2b0b5e2d

+1 -3
+1 -3
drivers/mfd/htc-pasic3.c
··· 147 147 if (!request_mem_region(r->start, resource_size(r), "pasic3")) 148 148 return -EBUSY; 149 149 150 - asic = kzalloc(sizeof(struct pasic3_data), GFP_KERNEL); 150 + asic = devm_kzalloc(dev, sizeof(struct pasic3_data), GFP_KERNEL); 151 151 if (!asic) 152 152 return -ENOMEM; 153 153 ··· 156 156 asic->mapping = ioremap(r->start, resource_size(r)); 157 157 if (!asic->mapping) { 158 158 dev_err(dev, "couldn't ioremap PASIC3\n"); 159 - kfree(asic); 160 159 return -ENOMEM; 161 160 } 162 161 ··· 194 195 iounmap(asic->mapping); 195 196 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 196 197 release_mem_region(r->start, resource_size(r)); 197 - kfree(asic); 198 198 return 0; 199 199 } 200 200