diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2016-12-20 17:37:49 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-01-04 04:44:23 -0500 |
commit | 2958db6f5625a9f566644a6830dc96e1b6879327 (patch) | |
tree | ee7dd9ef6b462da0a06c16051e62218f99163544 /drivers/gpu/nvgpu/gm206/bios_gm206.c | |
parent | b786e1798958a41694b8bdb202ca864306bef5e8 (diff) |
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>
Diffstat (limited to 'drivers/gpu/nvgpu/gm206/bios_gm206.c')
-rw-r--r-- | drivers/gpu/nvgpu/gm206/bios_gm206.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gm206/bios_gm206.c b/drivers/gpu/nvgpu/gm206/bios_gm206.c index 304de68e..c278cb08 100644 --- a/drivers/gpu/nvgpu/gm206/bios_gm206.c +++ b/drivers/gpu/nvgpu/gm206/bios_gm206.c | |||
@@ -852,8 +852,10 @@ static int gm206_bios_init(struct gk20a *g) | |||
852 | gk20a_dbg_info("using VBIOS overlay"); | 852 | gk20a_dbg_info("using VBIOS overlay"); |
853 | g->bios.size = bios_fw->size - ROM_FILE_PAYLOAD_OFFSET; | 853 | g->bios.size = bios_fw->size - ROM_FILE_PAYLOAD_OFFSET; |
854 | g->bios.data = vmalloc(g->bios.size); | 854 | g->bios.data = vmalloc(g->bios.size); |
855 | if (!g->bios.data) | 855 | if (!g->bios.data) { |
856 | return -ENOMEM; | 856 | err = -ENOMEM; |
857 | goto free_firmware; | ||
858 | } | ||
857 | 859 | ||
858 | memcpy(g->bios.data, &bios_fw->data[ROM_FILE_PAYLOAD_OFFSET], | 860 | memcpy(g->bios.data, &bios_fw->data[ROM_FILE_PAYLOAD_OFFSET], |
859 | g->bios.size); | 861 | g->bios.size); |
@@ -929,6 +931,10 @@ static int gm206_bios_init(struct gk20a *g) | |||
929 | } | 931 | } |
930 | 932 | ||
931 | return 0; | 933 | return 0; |
934 | |||
935 | free_firmware: | ||
936 | release_firmware(bios_fw); | ||
937 | return err; | ||
932 | } | 938 | } |
933 | 939 | ||
934 | void gm206_init_bios(struct gpu_ops *gops) | 940 | void gm206_init_bios(struct gpu_ops *gops) |