diff options
author | Amitoj Kaur Chawla <amitoj1606@gmail.com> | 2016-02-28 21:21:53 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-03-11 22:09:09 -0800 |
commit | 677c50721181b0375a763941ce188997588b1ace (patch) | |
tree | 2efd76dc3e14b3016458af471c0454a8871e0409 /drivers/staging/sm750fb | |
parent | fad2564eaa350368d95be2b7f0c832541dc9d09a (diff) | |
download | linux-677c50721181b0375a763941ce188997588b1ace.tar.gz linux-677c50721181b0375a763941ce188997588b1ace.tar.bz2 linux-677c50721181b0375a763941ce188997588b1ace.zip |
staging: sm750fb: Replace kzalloc with devm_kzalloc
Devm_ functions allocate memory that is released when a driver
detaches.
Replace kzalloc with devm_kzalloc and remove corresponding
kfrees from probe and remove functions of a pci_dev.
Also, an unnecessary label has been removed by replacing it
with a direct return statement.
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/sm750fb')
-rw-r--r-- | drivers/staging/sm750fb/sm750.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index aae3c7538d68..8ec81bed8b54 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -1058,7 +1058,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev, return err; err = -ENOMEM; - sm750_dev = kzalloc(sizeof(*sm750_dev), GFP_KERNEL); + sm750_dev = devm_kzalloc(&pdev->dev, sizeof(*sm750_dev), GFP_KERNEL); if (!sm750_dev) goto disable_pci; @@ -1090,7 +1090,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev, /* call chip specific mmap routine */ err = hw_sm750_map(sm750_dev, pdev); if (err) - goto free_sm750_dev; + return err; if (!sm750_dev->mtrr_off) sm750_dev->mtrr.vram = arch_phys_wc_add(sm750_dev->vidmem_start, @@ -1115,8 +1115,6 @@ static int lynxfb_pci_probe(struct pci_dev *pdev, release_fb: sm750fb_frambuffer_release(sm750_dev); -free_sm750_dev: - kfree(sm750_dev); disable_pci: pci_disable_device(pdev); return err; @@ -1134,7 +1132,6 @@ static void lynxfb_pci_remove(struct pci_dev *pdev) iounmap(sm750_dev->pvReg); iounmap(sm750_dev->pvMem); kfree(g_settings); - kfree(sm750_dev); } static int __init lynxfb_setup(char *options) |