[PATCH 27/38] superhyway: add missing put_device call

Levente Kurusa
2013-12-19T15:07:51Z

Also, this makes superhyway_device_release actually used.

Signed-off-by: Levente Kurusa <levex@linux.com>
---
drivers/sh/superhyway/superhyway.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/sh/superhyway/superhyway.c b/drivers/sh/superhyway/superhyway.c
index 2d9e7f3..765cf7d 100644
--- a/drivers/sh/superhyway/superhyway.c
+++ b/drivers/sh/superhyway/superhyway.c
@@ -54,6 +54,7 @@ int superhyway_add_device(unsigned long base, struct superhyway_device *sdev,
struct superhyway_bus *bus)
{
struct superhyway_device *dev = sdev;
+ int rc = 0;

if (!dev) {
dev = kzalloc(sizeof(struct superhyway_device), GFP_KERNEL);
@@ -86,8 +87,11 @@ int superhyway_add_device(unsigned long base, struct superhyway_device *sdev,
dev_set_name(&dev->dev, "%02x", superhyway_devices);

superhyway_devices++;
+ rc = device_register(&dev->dev);
+ if (rc)
+ put_device(&dev->dev);

- return device_register(&dev->dev);
+ return rc;
}

int superhyway_add_devices(struct superhyway_bus *bus,
--
1.8.3.1