summaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorRoman Kiryanov <rkir@google.com>2018-10-03 10:17:09 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-10-15 20:36:46 +0200
commit60a6e5233fcbe82a89b5b83b95b5d87e04b3be60 (patch)
treefcdc96c1733bd309b0ead365129a92bcdb5a1f47 /drivers/platform
parent08360e26f2a8eba0105ca7cd598547a1749b1c68 (diff)
downloadblackbird-obmc-linux-60a6e5233fcbe82a89b5b83b95b5d87e04b3be60.tar.gz
blackbird-obmc-linux-60a6e5233fcbe82a89b5b83b95b5d87e04b3be60.zip
platform: goldfish: pipe: Call misc_deregister if init fails
Undo effects of misc_register if driver's init fails after misc_register. Signed-off-by: Roman Kiryanov <rkir@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/goldfish/goldfish_pipe.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c
index 4013832f38fb..c386aaf40034 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -844,8 +844,10 @@ static int goldfish_pipe_device_init(struct platform_device *pdev,
dev->pipes_capacity = INITIAL_PIPES_CAPACITY;
dev->pipes = kcalloc(dev->pipes_capacity, sizeof(*dev->pipes),
GFP_KERNEL);
- if (!dev->pipes)
+ if (!dev->pipes) {
+ misc_deregister(&dev->miscdev);
return -ENOMEM;
+ }
/*
* We're going to pass two buffers, open_command_params and
@@ -858,6 +860,7 @@ static int goldfish_pipe_device_init(struct platform_device *pdev,
__get_free_page(GFP_KERNEL);
if (!dev->buffers) {
kfree(dev->pipes);
+ misc_deregister(&dev->miscdev);
return -ENOMEM;
}
OpenPOWER on IntegriCloud