Skip to content

Commit

Permalink
dmaengine: idxd: off by one in cleanup code
Browse files Browse the repository at this point in the history
commit ff58f7d upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and gregkh committed Jan 12, 2021
1 parent 8b109f4 commit 6e3c679
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/dma/idxd/sysfs.c
Expand Up @@ -379,7 +379,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 @@ -1639,7 +1639,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 6e3c679

Please sign in to comment.