[PATCH] nvdimm: Fix return value of nvdimm_bus_init() if class_create() fails

From: Axel Lin
Date: Sun Jun 28 2015 - 05:01:21 EST


Return proper error if class_create() fails.

Signed-off-by: Axel Lin <axel.lin@xxxxxxxxxx>
---
drivers/nvdimm/bus.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index ca80270..f6f6a91 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -644,8 +644,10 @@ int __init nvdimm_bus_init(void)
nvdimm_major = rc;

nd_class = class_create(THIS_MODULE, "nd");
- if (IS_ERR(nd_class))
+ if (IS_ERR(nd_class)) {
+ rc = PTR_ERR(nd_class);
goto err_class;
+ }

return 0;

--
2.1.0



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/