[PATCH 09/16] libusbg: Allow to store error information in usbg_gadget

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If error occurred during parsing user should have
an oportunity to get details about place and type
of error.

Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>
---
 src/usbg.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/usbg.c b/src/usbg.c
index f6841f4..62e66d8 100644
--- a/src/usbg.c
+++ b/src/usbg.c
@@ -63,6 +63,7 @@ struct usbg_gadget
 	TAILQ_HEAD(chead, usbg_config) configs;
 	TAILQ_HEAD(fhead, usbg_function) functions;
 	usbg_state *parent;
+	config_t *last_failed_import;
 };
 
 struct usbg_config
@@ -568,6 +569,12 @@ static void usbg_free_gadget(usbg_gadget *g)
 {
 	usbg_config *c;
 	usbg_function *f;
+
+	if (g->last_failed_import) {
+		config_destroy(g->last_failed_import);
+		free(g->last_failed_import);
+	}
+
 	while (!TAILQ_EMPTY(&g->configs)) {
 		c = TAILQ_FIRST(&g->configs);
 		TAILQ_REMOVE(&g->configs, c, cnode);
@@ -605,6 +612,7 @@ static usbg_gadget *usbg_allocate_gadget(const char *path, const char *name,
 	if (g) {
 		TAILQ_INIT(&g->functions);
 		TAILQ_INIT(&g->configs);
+		g->last_failed_import = NULL;
 		g->name = strdup(name);
 		g->path = strdup(path);
 		g->parent = parent;
-- 
1.7.9.5

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux