]> git.baikalelectronics.ru Git - kernel.git/commit
drm/amd/powerplay: Fix error handling in smu_init_fb_allocations()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 7 Oct 2019 09:02:06 +0000 (12:02 +0300)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 7 Oct 2019 20:10:56 +0000 (15:10 -0500)
commit78cab7d9ce575f71121b12198d1c77e753fe986e
treec106a9c49d87d7137c4e380e666682b8ccbc66f8
parentcd3af33a99d562d623369fc9b0ab04e3688d1d7f
drm/amd/powerplay: Fix error handling in smu_init_fb_allocations()

The error handling is off by one.  We should not free the first
"tables[i].bo" without decrementing "i" because that might result in a
double free.  The second problem is that when an error occurs, then the
zeroth element "tables[0].bo" isn't freed.

I had make "i" signed int for the error handling to work, so I just
updated "ret" as well as a clean up.

Fixes: 55bdcf81d857 ("drm/amd/powerplay: implement smu_init(fini)_fb_allocations function")
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c