mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: Release VBIOS firmware if alloc fails
We first load VBIOS firmware from file, and then attempt to allocate space into which we copy the data. If allocation fails, we do not release the firmware. Add a release_firmware() in the error path. Change-Id: Iaa995e93bf8d5a23e08c5e332f70b203ac2e09db Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1275740 GVS: Gerrit_Virtual_Submit Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
b786e17989
commit
2958db6f56
@@ -852,8 +852,10 @@ static int gm206_bios_init(struct gk20a *g)
|
||||
gk20a_dbg_info("using VBIOS overlay");
|
||||
g->bios.size = bios_fw->size - ROM_FILE_PAYLOAD_OFFSET;
|
||||
g->bios.data = vmalloc(g->bios.size);
|
||||
if (!g->bios.data)
|
||||
return -ENOMEM;
|
||||
if (!g->bios.data) {
|
||||
err = -ENOMEM;
|
||||
goto free_firmware;
|
||||
}
|
||||
|
||||
memcpy(g->bios.data, &bios_fw->data[ROM_FILE_PAYLOAD_OFFSET],
|
||||
g->bios.size);
|
||||
@@ -929,6 +931,10 @@ static int gm206_bios_init(struct gk20a *g)
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
free_firmware:
|
||||
release_firmware(bios_fw);
|
||||
return err;
|
||||
}
|
||||
|
||||
void gm206_init_bios(struct gpu_ops *gops)
|
||||
|
||||
Reference in New Issue
Block a user