[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180914175122.21036-16-rkir@google.com>
Date: Fri, 14 Sep 2018 10:51:17 -0700
From: rkir@...gle.com
To: gregkh@...uxfoundation.org
Cc: tkjos@...gle.com, linux-kernel@...r.kernel.org,
Roman Kiryanov <rkir@...gle.com>
Subject: [PATCH 16/21] platform: goldfish: pipe: Call misc_deregister if init fails
From: Roman Kiryanov <rkir@...gle.com>
Undo effects of misc_register if driver's init fails after
misc_register.
Signed-off-by: Roman Kiryanov <rkir@...gle.com>
---
drivers/platform/goldfish/goldfish_pipe_v2.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/goldfish/goldfish_pipe_v2.c b/drivers/platform/goldfish/goldfish_pipe_v2.c
index 9fa5136be909..e3358c682562 100644
--- a/drivers/platform/goldfish/goldfish_pipe_v2.c
+++ b/drivers/platform/goldfish/goldfish_pipe_v2.c
@@ -1159,8 +1159,10 @@ int goldfish_pipe_device_v2_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
@@ -1173,6 +1175,7 @@ int goldfish_pipe_device_v2_init(struct platform_device *pdev,
__get_free_page(GFP_KERNEL);
if (!dev->buffers) {
kfree(dev->pipes);
+ misc_deregister(&dev->miscdev);
return -ENOMEM;
}
--
2.19.0.397.gdd90340f6a-goog
Powered by blists - more mailing lists