Skip to contentSkip to conversation

Staging: comedi: check the return value of kobject_set_name

PATCH In review Anton Protopopov 3 participants 7 messages Jun 7, 2014 – Jul 9, 2014 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: comedi: check the return value of kobject_set_name

Added a check of the return value of the kobject_set_name function.

---
 drivers/staging/comedi/comedi_fops.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/staging/comedi/comedi_fops.c +8 -1
index 9d99fb3..dfeefa2 100644
@@ -2597,7 +2597,14 @@ static int __init comedi_init(void)
 		return -EIO;
 	cdev_init(&comedi_cdev, &comedi_fops);
 	comedi_cdev.owner = THIS_MODULE;
-	kobject_set_name(&comedi_cdev.kobj, "comedi");
+
+	retval = kobject_set_name(&comedi_cdev.kobj, "comedi");
+	if (retval) {
+		unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
+					 COMEDI_NUM_MINORS);
+		return retval;
+	}
+
 	if (cdev_add(&comedi_cdev, MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS)) {
 		unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
 					 COMEDI_NUM_MINORS);
Signature · 1 line
1.8.3.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Anton Protopopov

Added a check of the return value of the kobject_set_name function.

---
  drivers/staging/comedi/comedi_fops.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
Signature · 2 lines
-=( Ian Abbott @ MEV Ltd.    E-mail: <[email protected]>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-
#2 lore raw

2014-06-09 14:01 GMT+04:00 Ian Abbott <[email protected]>:

Quoted 11 lines · Anton Protopopov
Quoted 7 lines

Added a check of the return value of the kobject_set_name function.

---
  drivers/staging/comedi/comedi_fops.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)

This patch was lost, I guess?

Quoted 4 lines

--
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-

maintainer
#3 lore raw
Quoted 11 lines · Anton Protopopov

2014-06-09 14:01 GMT+04:00 Ian Abbott <[email protected]>:

Quoted 10 lines · Anton Protopopov
Quoted 7 lines

Added a check of the return value of the kobject_set_name function.

---
  drivers/staging/comedi/comedi_fops.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
Quoted 3 lines
Quoted 1 line

This patch was lost, I guess?

I don't seem to have it anymore in my inbox, please resend.

greg k-h

#4 lore raw

09.07.2014 08:28, gregkh пишет:

Quoted 12 lines · Anton Protopopov
Quoted 11 lines

2014-06-09 14:01 GMT+04:00 Ian Abbott <[email protected]>:

Quoted 10 lines · Anton Protopopov
Quoted 7 lines

Added a check of the return value of the kobject_set_name function.

---
  drivers/staging/comedi/comedi_fops.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

This patch was lost, I guess?

I don't seem to have it anymore in my inbox, please resend.

greg k-h

Added a check of the return value of the kobject_set_name function.

---
 drivers/staging/comedi/comedi_fops.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/staging/comedi/comedi_fops.c +8 -1
index 9d99fb3..dfeefa2 100644
@@ -2597,7 +2597,14 @@ static int __init comedi_init(void)
 		return -EIO;
 	cdev_init(&comedi_cdev, &comedi_fops);
 	comedi_cdev.owner = THIS_MODULE;
-	kobject_set_name(&comedi_cdev.kobj, "comedi");
+
+	retval = kobject_set_name(&comedi_cdev.kobj, "comedi");
+	if (retval) {
+		unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
+					 COMEDI_NUM_MINORS);
+		return retval;
+	}
+
 	if (cdev_add(&comedi_cdev, MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS)) {
 		unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
 					 COMEDI_NUM_MINORS);
Signature · 1 line
1.8.3.4
maintainer
#5 lore raw
Quoted 25 lines · Anton Protopopov

09.07.2014 08:28, gregkh пишет:

Quoted 12 lines · Anton Protopopov
Quoted 11 lines

2014-06-09 14:01 GMT+04:00 Ian Abbott <[email protected]>:

Quoted 10 lines · Anton Protopopov
Quoted 7 lines

Added a check of the return value of the kobject_set_name function.

---
  drivers/staging/comedi/comedi_fops.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

This patch was lost, I guess?

I don't seem to have it anymore in my inbox, please resend.

greg k-h

Quoted 6 lines

Added a check of the return value of the kobject_set_name function.

---
 drivers/staging/comedi/comedi_fops.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Please send in a format I can apply in (i.e. I don't have to edit the changelog by hand...)

#6 lore raw

PATCH 1/1 Staging: comedi: check the return value of kobject_set_name

Added a check of the return value of the kobject_set_name function.

---
 drivers/staging/comedi/comedi_fops.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/staging/comedi/comedi_fops.c +8 -1
index 9d99fb3..dfeefa2 100644
@@ -2597,7 +2597,14 @@ static int __init comedi_init(void)
 		return -EIO;
 	cdev_init(&comedi_cdev, &comedi_fops);
 	comedi_cdev.owner = THIS_MODULE;
-	kobject_set_name(&comedi_cdev.kobj, "comedi");
+
+	retval = kobject_set_name(&comedi_cdev.kobj, "comedi");
+	if (retval) {
+		unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
+					 COMEDI_NUM_MINORS);
+		return retval;
+	}
+
 	if (cdev_add(&comedi_cdev, MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS)) {
 		unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
 					 COMEDI_NUM_MINORS);
Signature · 1 line
1.8.3.4