Skip to content

Commit

Permalink
misc/pvpanic-mmio: Fix error handling in 'pvpanic_mmio_probe()'
Browse files Browse the repository at this point in the history
There is no error handling path in the probe function.
Switch to managed resource so that errors in the probe are handled easily
and simplify the remove function accordingly.

Fixes: b3c0f87 ("misc/pvpanic: probe multiple instances")
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/2a5dab18f10db783b27e0579ba66cc38d610734a.1621665058.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Christophe JAILLET authored and Greg Kroah-Hartman committed May 27, 2021
1 parent b647ceb commit 9a3c72e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/misc/pvpanic/pvpanic-mmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static int pvpanic_mmio_probe(struct platform_device *pdev)
return -EINVAL;
}

pi = kmalloc(sizeof(*pi), GFP_ATOMIC);
pi = devm_kmalloc(dev, sizeof(*pi), GFP_ATOMIC);
if (!pi)
return -ENOMEM;

Expand All @@ -114,7 +114,6 @@ static int pvpanic_mmio_remove(struct platform_device *pdev)
struct pvpanic_instance *pi = dev_get_drvdata(&pdev->dev);

pvpanic_remove(pi);
kfree(pi);

return 0;
}
Expand Down

0 comments on commit 9a3c72e

Please sign in to comment.