From: Michael Brown Date: Mon, 29 Sep 2008 23:31:02 +0000 (+0100) Subject: [hermon] Fix off-by-one error in the failure path in hermon_probe() X-Git-Tag: v0.9.5~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76f6cad8afd5d7284ecef2b9f74ca22458f7cbdb;p=thirdparty%2Fipxe.git [hermon] Fix off-by-one error in the failure path in hermon_probe() --- diff --git a/src/drivers/infiniband/hermon.c b/src/drivers/infiniband/hermon.c index f5a8ba0c1..3ca600336 100644 --- a/src/drivers/infiniband/hermon.c +++ b/src/drivers/infiniband/hermon.c @@ -2252,9 +2252,9 @@ static int hermon_probe ( struct pci_device *pci, return 0; - i = ( HERMON_NUM_PORTS - 1 ); + i = HERMON_NUM_PORTS; err_register_ibdev: - for ( ; i >= 0 ; i-- ) + for ( i-- ; i >= 0 ; i-- ) unregister_ibdev ( hermon->ibdev[i] ); hermon_destroy_eq ( hermon ); err_create_eq: @@ -2270,9 +2270,9 @@ static int hermon_probe ( struct pci_device *pci, err_mailbox_out: free_dma ( hermon->mailbox_in, HERMON_MBOX_SIZE ); err_mailbox_in: - i = ( HERMON_NUM_PORTS - 1 ); + i = HERMON_NUM_PORTS; err_alloc_ibdev: - for ( ; i >= 0 ; i-- ) + for ( i-- ; i >= 0 ; i-- ) ibdev_put ( hermon->ibdev[i] ); free ( hermon ); err_alloc_hermon: