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

mfd: janz-cmodio: 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
fa75d4a6 8692881e

+4 -8
+4 -8
drivers/mfd/janz-cmodio.c
··· 183 183 struct cmodio_device *priv; 184 184 int ret; 185 185 186 - priv = kzalloc(sizeof(*priv), GFP_KERNEL); 186 + priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL); 187 187 if (!priv) { 188 188 dev_err(&dev->dev, "unable to allocate private data\n"); 189 - ret = -ENOMEM; 190 - goto out_return; 189 + return -ENOMEM; 191 190 } 192 191 193 192 pci_set_drvdata(dev, priv); ··· 196 197 ret = pci_enable_device(dev); 197 198 if (ret) { 198 199 dev_err(&dev->dev, "unable to enable device\n"); 199 - goto out_free_priv; 200 + return ret; 200 201 } 201 202 202 203 pci_set_master(dev); ··· 247 248 pci_release_regions(dev); 248 249 out_pci_disable_device: 249 250 pci_disable_device(dev); 250 - out_free_priv: 251 - kfree(priv); 252 - out_return: 251 + 253 252 return ret; 254 253 } 255 254 ··· 260 263 iounmap(priv->ctrl); 261 264 pci_release_regions(dev); 262 265 pci_disable_device(dev); 263 - kfree(priv); 264 266 } 265 267 266 268 #define PCI_VENDOR_ID_JANZ 0x13c3