[svn-commits] tzafrir: linux/trunk r9626 - /linux/trunk/drivers/dahdi/dahdi-base.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Jan 10 15:42:54 CST 2011
Author: tzafrir
Date: Mon Jan 10 15:42:49 2011
New Revision: 9626
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9626
Log:
cleaner error handling in dahdi_register
* Better error handling in dahdi_register.
* Fail registration if fails creating proc entry for span.
Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Acked-by: Shaun Ruffell <sruffell at digium.com>
Modified:
linux/trunk/drivers/dahdi/dahdi-base.c
Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=9626&r1=9625&r2=9626
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Mon Jan 10 15:42:49 2011
@@ -6481,6 +6481,8 @@
NULL, chan_name);
if (IS_ERR(dummy)) {
res = PTR_ERR(dummy);
+ chan_err(chan, "Failed creating sysfs device: %d\n",
+ res);
goto cleanup;
}
@@ -6606,10 +6608,17 @@
span->proc_entry = create_proc_read_entry(tempfile, 0444,
root_proc_entry, dahdi_proc_read,
(int *) (long) span->spanno);
+ if (!span->proc_entry) {
+ res = -EFAULT;
+ span_err(span, "Error creating procfs entry\n");
+ goto cleanup;
+ }
}
#endif
res = span_sysfs_create(span);
+ if (res)
+ goto cleanup;
if (debug & DEBUG_MAIN) {
module_printk(KERN_NOTICE, "Registered Span %d ('%s') with "
@@ -6626,6 +6635,23 @@
__dahdi_find_master_span();
return 0;
+
+cleanup:
+#ifdef CONFIG_PROC_FS
+ if (span->proc_entry) {
+ char tempfile[17];
+
+ snprintf(tempfile, sizeof(tempfile), "dahdi/%d", span->spanno);
+ remove_proc_entry(tempfile, NULL);
+ span->proc_entry = NULL;
+ }
+#endif
+ for (x = 0; x < span->channels; x++) {
+ struct dahdi_chan *chan = span->chans[x];
+ if (test_bit(DAHDI_FLAGBIT_REGISTERED, &chan->flags))
+ dahdi_chan_unreg(chan);
+ }
+ return res;
}
/**
More information about the svn-commits
mailing list