From: Konstantin Khlebnikov Date: Fri, 14 Dec 2012 11:02:44 +0000 (+0400) Subject: staging: vme_pio2: fix oops on module unloading X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=9349f8af28ea89639b3c97da583d60631ed10398;p=openwrt%2Fstaging%2Fblogic.git staging: vme_pio2: fix oops on module unloading This patch forbids loading vme_pio2 module without specifing "num_bus" parameter. Otherwise on module unloading pio2_exit() calls vme_unregister_driver() for not registered pio2_driver. Signed-off-by: Konstantin Khlebnikov Cc: Manohar Vanga Acked-by: Martyn Welch Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/vme/devices/vme_pio2_core.c b/drivers/staging/vme/devices/vme_pio2_core.c index 0331178ca3b3..bf73ba26e88a 100644 --- a/drivers/staging/vme/devices/vme_pio2_core.c +++ b/drivers/staging/vme/devices/vme_pio2_core.c @@ -162,11 +162,9 @@ static struct vme_driver pio2_driver = { static int __init pio2_init(void) { - int retval = 0; - if (bus_num == 0) { pr_err("No cards, skipping registration\n"); - goto err_nocard; + return -ENODEV; } if (bus_num > PIO2_CARDS_MAX) { @@ -176,15 +174,7 @@ static int __init pio2_init(void) } /* Register the PIO2 driver */ - retval = vme_register_driver(&pio2_driver, bus_num); - if (retval != 0) - goto err_reg; - - return retval; - -err_reg: -err_nocard: - return retval; + return vme_register_driver(&pio2_driver, bus_num); } static int pio2_match(struct vme_dev *vdev)