staging/sm7xxfb: use module_pci_driver macro
PATCH 1/2 staging/sm7xxfb: use module_pci_driver macro
as the manual of module_pci_driver says that it can be used when the init and exit functions of the module does nothing but the pci_register_driver and pci_unregister_driver.
use it for the sm7xxfb driver, as the driver does nothing in its _init and _exit functions but the register and unregister.
Signed-off-by Devendra Naga <[email protected]>
--- drivers/staging/sm7xxfb/sm7xxfb.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/staging/sm7xxfb/sm7xxfb.c +1 -12
@@ -1058,18 +1058,7 @@ static struct pci_driver smtcfb_driver = { .driver.pm = SM7XX_PM_OPS, }; -static int __init smtcfb_init (void ) -{ -return pci_register_driver (&smtcfb_driver); -} - -static void __exit smtcfb_exit(void) -{ -pci_unregister_driver (&smtcfb_driver); -} - -module_init (smtcfb_init); -module_exit (smtcfb_exit); +module_pci_driver (smtcfb_driver);MODULE_AUTHOR ("Siliconmotion " );MODULE_DESCRIPTION ("Framebuffer driver for SMI Graphic Cards" );
Signature · 1 line
1.7.9.5
PATCH 2/2 staging/sm7xxfb: return a proper err for smtc_alloc_fb_info failure
as smtc_alloc_fb_info can fail, but we are returning the 0, how? because the pci_enable_device succeeded, which makes the probe return 0, and may cause panics or some strange problems at remove when driver unloaded by modprobe -r.
so return err properly as smtc_alloc_fb_info is doing kzallocs its good to do -ENOMEM
Signed-off-by Devendra Naga <[email protected]>
--- drivers/staging/sm7xxfb/sm7xxfb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/sm7xxfb/sm7xxfb.c +3 -1
@@ -808,8 +808,10 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev, sfb =smtc_alloc_fb_info (pdev, name); -if (!sfb) +if (!sfb) { + err = -ENOMEM ; goto failed_free; + } sfb->chip_id = ent->device;sprintf (name,"sm%Xfb" , sfb->chip_id);
Signature · 1 line
1.7.9.5