Skip to content

Commit

Permalink
dmaengine: idxd: off by one in cleanup code
Browse files Browse the repository at this point in the history
The clean up is off by one so this will start at "i" and it should start
with "i - 1" and then it doesn't unregister the zeroeth elements in the
array.

Fixes: c52ca47 ("dmaengine: idxd: add configuration component of driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/X9nFeojulsNqUSnG@mwanda
Signed-off-by: Vinod Koul <vkoul@kernel.org>
  • Loading branch information
Dan Carpenter authored and vinodkoul committed Dec 29, 2020
1 parent 26b614f commit ff58f7d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/dma/idxd/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ int idxd_register_driver(void)
return 0;

drv_fail:
for (; i > 0; i--)
while (--i >= 0)
driver_unregister(&idxd_drvs[i]->drv);
return rc;
}
Expand Down Expand Up @@ -1840,7 +1840,7 @@ int idxd_register_bus_type(void)
return 0;

bus_err:
for (; i > 0; i--)
while (--i >= 0)
bus_unregister(idxd_bus_types[i]);
return rc;
}
Expand Down

0 comments on commit ff58f7d

Please sign in to comment.