Skip to contentSkip to conversation

staging/crystalhd: assign PTR_ERR at fail cases to rc in chd_dec_init_chdev

PATCH New Devendra Naga 1 participant 1 message Aug 5, 2012 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 staging/crystalhd: assign PTR_ERR at fail cases to rc in chd_dec_init_chdev

the rc assignment to PTR_ERR at fail cases of class_create and device_create are missed out, return proper error rather than returning -ENODEV.

---
 drivers/staging/crystalhd/crystalhd_lnx.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/staging/crystalhd/crystalhd_lnx.c +2 -0
index d9e3d61..0582ac0 100644
@@ -373,6 +373,7 @@ static int __devinit chd_dec_init_chdev(struct crystalhd_adp *adp)
 	/* register crystalhd class */
 	crystalhd_class = class_create(THIS_MODULE, "crystalhd");
 	if (IS_ERR(crystalhd_class)) {
+		rc = PTR_ERR(crystalhd_class);
 		BCMLOG_ERR("failed to create class\n");
 		goto fail;
 	}
@@ -380,6 +381,7 @@ static int __devinit chd_dec_init_chdev(struct crystalhd_adp *adp)
 	dev = device_create(crystalhd_class, NULL, MKDEV(adp->chd_dec_major, 0),
 			    NULL, "crystalhd");
 	if (IS_ERR(dev)) {
+		rc = PTR_ERR(crystalhd_class);
 		BCMLOG_ERR("failed to create device\n");
 		goto device_create_fail;
 	}
Signature · 1 line
1.7.9.5