mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/2] staging/crystalhd: unregister chardev when class_create fails in chd_dec_init_chdev
@ 2012-08-05 21:14 Devendra Naga
  0 siblings, 0 replies; only message in thread
From: Devendra Naga @ 2012-08-05 21:14 UTC (permalink / raw)
  To: devel, linux-kernel
  Cc: Naren Sankar, Jarod Wilson, Scott Davilla, Manu Abraham,
	Greg Kroah-Hartman, Jorgyano Vieira, Devendra Naga

we missed a unregiser_chrdev if the class_create and subsequent function calls / checks fail

Signed-off-by: Devendra Naga <develkernel412222@gmail.com>
---
 drivers/staging/crystalhd/crystalhd_lnx.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/crystalhd/crystalhd_lnx.c b/drivers/staging/crystalhd/crystalhd_lnx.c
index 0582ac0..5909d8d 100644
--- a/drivers/staging/crystalhd/crystalhd_lnx.c
+++ b/drivers/staging/crystalhd/crystalhd_lnx.c
@@ -375,7 +375,7 @@ static int __devinit chd_dec_init_chdev(struct crystalhd_adp *adp)
 	if (IS_ERR(crystalhd_class)) {
 		rc = PTR_ERR(crystalhd_class);
 		BCMLOG_ERR("failed to create class\n");
-		goto fail;
+		goto class_create_fail;
 	}
 
 	dev = device_create(crystalhd_class, NULL, MKDEV(adp->chd_dec_major, 0),
@@ -412,6 +412,8 @@ elem_pool_fail:
 	device_destroy(crystalhd_class, MKDEV(adp->chd_dec_major, 0));
 device_create_fail:
 	class_destroy(crystalhd_class);
+class_create_fail:
+	unregister_chrdev(adp->chd_dec_major, CRYSTALHD_API_NAME);
 fail:
 	return rc;
 }
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-08-05 21:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-05 21:14 [PATCH 2/2] staging/crystalhd: unregister chardev when class_create fails in chd_dec_init_chdev Devendra Naga

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®