Skip to contentSkip to conversation

atyfb: Honor the return value of pci_register_driver

PATCH In review Antonino A. Daplas 2 participants 5 messages Aug 10, 2006 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 5/8 atyfb: Honor the return value of pci_register_driver

Do not ignore the return value of pci_register_driver().

---

 drivers/video/aty/atyfb_base.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/video/aty/atyfb_base.c +2 -3
index 053ff63..605fb7e 100644
@@ -3868,12 +3868,11 @@ #ifndef MODULE
 #endif
 
 #ifdef CONFIG_PCI
-    pci_register_driver(&atyfb_driver);
+    return pci_register_driver(&atyfb_driver);
 #endif
 #ifdef CONFIG_ATARI
-    atyfb_atari_probe();
+    return atyfb_atari_probe();
 #endif
-    return 0;
 }
 
 static void __exit atyfb_exit(void)

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#1 lore raw
Quoted 15 lines · Antonino A. Daplas

Do not ignore the return value of pci_register_driver().

---

 drivers/video/aty/atyfb_base.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/video/aty/atyfb_base.c +0 -0
index 053ff63..605fb7e 100644
@@ -3868,12 +3868,11 @@ #ifndef MODULE
 #endif
 

drivers/video/aty/atyfb_base.c #ifndef MODULE · line 3876

Quoted 10 lines
drivers/video/aty/atyfb_base.c +2 -3
 #ifdef CONFIG_PCI
-    pci_register_driver(&atyfb_driver);
+    return pci_register_driver(&atyfb_driver);
 #endif
 #ifdef CONFIG_ATARI
-    atyfb_atari_probe();
+    return atyfb_atari_probe();
 #endif
-    return 0;
 }

Actually it's a bit more complicated, as some Ataris do have PCI (although currently Atari Hades PCI support is broken).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#2 lore raw

PATCH 5/8 atyfb: Honor the return value of pci_register_driver

Check return value of pci_register_driver().

---

Quoted 4 lines · Geert Uytterhoeven

Actually it's a bit more complicated, as some Ataris do have PCI (although currently Atari Hades PCI support is broken).

How about this?

 drivers/video/aty/atyfb_base.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/video/aty/atyfb_base.c +6 -3
index 053ff63..3f1bdcd 100644
@@ -3859,6 +3859,7 @@ #endif  /*  MODULE  */
 
 static int __devinit atyfb_init(void)
 {
+    int err = 0;
 #ifndef MODULE
     char *option = NULL;
 
@@ -3868,12 +3869,14 @@ #ifndef MODULE
 #endif
 
 #ifdef CONFIG_PCI
-    pci_register_driver(&atyfb_driver);
+    err = pci_register_driver(&atyfb_driver);
 #endif
 #ifdef CONFIG_ATARI
-    atyfb_atari_probe();
+    if (!err)
+	err = atyfb_atari_probe();
 #endif
-    return 0;
+
+    return err;
 }
 
 static void __exit atyfb_exit(void)

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#3 lore raw
Quoted 11 lines · Antonino A. Daplas

Check return value of pci_register_driver().

---

Quoted 4 lines · Geert Uytterhoeven

Actually it's a bit more complicated, as some Ataris do have PCI (although currently Atari Hades PCI support is broken).

How about this?

Looks better.

Quoted 23 lines
 drivers/video/aty/atyfb_base.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/video/aty/atyfb_base.c +2 -1
index 053ff63..3f1bdcd 100644
@@ -3859,6 +3859,7 @@ #endif  /*  MODULE  */
 
 static int __devinit atyfb_init(void)
 {
+    int err = 0;
 #ifndef MODULE
     char *option = NULL;
 
@@ -3868,12 +3869,14 @@ #ifndef MODULE
 #endif
 
 #ifdef CONFIG_PCI
-    pci_register_driver(&atyfb_driver);
+    err = pci_register_driver(&atyfb_driver);
 #endif
 #ifdef CONFIG_ATARI

drivers/video/aty/atyfb_base.c #ifndef MODULE · line 3882

Quoted 10 lines
drivers/video/aty/atyfb_base.c +4 -2
-    atyfb_atari_probe();
+    if (!err)
+	err = atyfb_atari_probe();
 #endif
-    return 0;
+
+    return err;
 }
 
 static void __exit atyfb_exit(void)

I guess pci_register_driver() failing is a fairly rare and catastrophical event?

If not, atyfb_atari_probe() should probably continue if pci_register_driver() failed.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#4 lore raw

PATCH RESEND 5/8 atyfb: Honor the return value of pci_register_driver

In reply to Geert Uytterhoeven

Check return value of pci_register_driver().

---

Quoted 5 lines · Geert Uytterhoeven

On Thu, 10 Aug 2006, Antonino A. Daplas wrote:

Actually it's a bit more complicated, as some Ataris do have PCI (although currently Atari Hades PCI support is broken).

This one may be better.

Tony

 drivers/video/aty/atyfb_base.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
drivers/video/aty/atyfb_base.c +5 -3
index 053ff63..d6be4c7 100644
@@ -3859,6 +3859,7 @@ #endif  /*  MODULE  */
 
 static int __devinit atyfb_init(void)
 {
+    int err1 = 1, err2 = 1;
 #ifndef MODULE
     char *option = NULL;
 
@@ -3868,12 +3869,13 @@ #ifndef MODULE
 #endif
 
 #ifdef CONFIG_PCI
-    pci_register_driver(&atyfb_driver);
+    err1 = pci_register_driver(&atyfb_driver);
 #endif
 #ifdef CONFIG_ATARI
-    atyfb_atari_probe();
+    err2 = atyfb_atari_probe();
 #endif
-    return 0;
+
+    return (err1 && err2) ? -ENODEV : 0;
 }
 
 static void __exit atyfb_exit(void)

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642