lkml.org 
[lkml]   [2018]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v4 2/3] driver-core: record error on bus registration
Date
If bus_register() fails on a driver then record the error code so that
it can be inspected later on.

Signed-off-by: Florian Schmaus <flo@geekplace.eu>
---

Notes:
- Also record ENOMEM error if initial alloc fails

drivers/base/bus.c | 2 ++
include/linux/device.h | 1 +
2 files changed, 3 insertions(+)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index ef6183306b40..dce677dddba4 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -152,6 +152,7 @@ static void bus_release(struct kobject *kobj)

kfree(priv);
bus->p = NULL;
+ bus->bus_register_error = 0;
}

static struct kobj_type bus_ktype = {
@@ -915,6 +916,7 @@ int bus_register(struct bus_type *bus)
out:
kfree(bus->p);
bus->p = NULL;
+ bus->bus_register_error = retval;
return retval;
}
EXPORT_SYMBOL_GPL(bus_register);
diff --git a/include/linux/device.h b/include/linux/device.h
index 0059b99e1f25..5b1f3c08bebe 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -135,6 +135,7 @@ struct bus_type {
const struct iommu_ops *iommu_ops;

struct subsys_private *p;
+ int bus_register_error;
struct lock_class_key lock_key;

bool force_dma;
--
2.16.1
\
 
 \ /
  Last update: 2018-05-16 14:06    [W:0.053 / U:14.896 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site