lkml.org 
[lkml]   [2012]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] handle error path in edac_mc_sysfs_init()
Date
Handle errors on edac_mc_sysfs_init()'s error path

Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
---
drivers/edac/edac_mc_sysfs.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index ed0bc07..ea34ece 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -1124,11 +1124,16 @@ int __init edac_mc_sysfs_init(void)
edac_subsys = edac_get_sysfs_subsys();
if (edac_subsys == NULL) {
edac_dbg(1, "no edac_subsys\n");
- return -EINVAL;
+ err = -EINVAL;
+ goto out;
}

mci_pdev = kzalloc(sizeof(*mci_pdev), GFP_KERNEL);
-
+ if (!mci_pdev) {
+ err = -ENOMEM;
+ goto out_put_sysfs;
+ }
+
mci_pdev->bus = edac_subsys;
mci_pdev->type = &mc_attr_type;
device_initialize(mci_pdev);
@@ -1141,6 +1146,11 @@ int __init edac_mc_sysfs_init(void)
edac_dbg(0, "device %s created\n", dev_name(mci_pdev));

return 0;
+
+out_put_sysfs:
+ edac_put_sysfs_subsys();
+out:
+ return err;
}

void __exit edac_mc_sysfs_exit(void)
--
1.7.9.5


\
 
 \ /
  Last update: 2012-10-25 18:21    [W:0.059 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site