dmaengine: idxd: off by one in cleanup code
Subsystems (3)
PATCH 1/1 dmaengine: idxd: off by one in cleanup code
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 c52ca478233c ("dmaengine: idxd: add configuration component of driver")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/dma/idxd/sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/idxd/sysfs.c +2 -2
@@ -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; }
@@ -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; }
Signature · 1 line
2.29.2
Quoted 6 lines · On Wed, 16 Dec 2020 11:29:46 +0300 Dan Carpenter <[email protected]>…
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 c52ca478233c ("dmaengine: idxd: add configuration component ofdriver") Signed-off-by: Dan Carpenter <[email protected]>
Acked-by Dave Jiang <[email protected]>
Thanks Dan!
Quoted 26 lines
--- drivers/dma/idxd/sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/dma/idxd/sysfs.c +2
-2@@ -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; }@@ -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; }
Quoted 3 lines · Dan Carpenter
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.
Applied, thanks
Signature · 1 line
~Vinod