From 7f55cfb6e92eb56565fb62684b02664c9cf05c40 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Mon, 2 Jan 2017 18:01:44 +0530 Subject: gpu: nvgpu: return error on pmu_ucode_details() failure In lsfm_discover_ucode_images(), we currently collect pmu ucode details with API pmu_ucode_details() But if this API fails, we still continue loading other firmwares In case loading of pmu firmware fails due to some reason, we should actually bail out immediately with error Also, remove unnecessary chekc (ucode_img.lsf_desc != NULL) since pmu_ucode_details() ensures that this cannot be NULL Bug 200265373 Change-Id: I68e7f9575e2a07b473ceacc528a5d172b58d6fb6 Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1276555 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gm20b/acr_gm20b.c | 53 ++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c index 1d0379c5..1dda2d47 100644 --- a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -473,33 +473,32 @@ static int lsfm_discover_ucode_images(struct gk20a *g, /* Obtain the PMU ucode image and add it to the list if required*/ memset(&ucode_img, 0, sizeof(ucode_img)); status = pmu_ucode_details(g, &ucode_img); - if (status == 0) { - if (ucode_img.lsf_desc != NULL) { - /* The falon_id is formed by grabbing the static base - * falon_id from the image and adding the - * engine-designated falcon instance.*/ - pmu->pmu_mode |= PMU_SECURE_MODE; - falcon_id = ucode_img.lsf_desc->falcon_id + - ucode_img.flcn_inst; - - if (!lsfm_falcon_disabled(g, plsfm, falcon_id)) { - pmu->falcon_id = falcon_id; - if (lsfm_add_ucode_img(g, plsfm, &ucode_img, - pmu->falcon_id) == 0) - pmu->pmu_mode |= PMU_LSFM_MANAGED; - - plsfm->managed_flcn_cnt++; - } else { - gm20b_dbg_pmu("id not managed %d\n", - ucode_img.lsf_desc->falcon_id); - } - } + if (status) + return status; + + /* The falon_id is formed by grabbing the static base + * falon_id from the image and adding the + * engine-designated falcon instance.*/ + pmu->pmu_mode |= PMU_SECURE_MODE; + falcon_id = ucode_img.lsf_desc->falcon_id + + ucode_img.flcn_inst; + + if (!lsfm_falcon_disabled(g, plsfm, falcon_id)) { + pmu->falcon_id = falcon_id; + if (lsfm_add_ucode_img(g, plsfm, &ucode_img, + pmu->falcon_id) == 0) + pmu->pmu_mode |= PMU_LSFM_MANAGED; + + plsfm->managed_flcn_cnt++; + } else { + gm20b_dbg_pmu("id not managed %d\n", + ucode_img.lsf_desc->falcon_id); + } - /*Free any ucode image resources if not managing this falcon*/ - if (!(pmu->pmu_mode & PMU_LSFM_MANAGED)) { - gm20b_dbg_pmu("pmu is not LSFM managed\n"); - lsfm_free_ucode_img_res(&ucode_img); - } + /*Free any ucode image resources if not managing this falcon*/ + if (!(pmu->pmu_mode & PMU_LSFM_MANAGED)) { + gm20b_dbg_pmu("pmu is not LSFM managed\n"); + lsfm_free_ucode_img_res(&ucode_img); } /* Enumerate all constructed falcon objects, -- cgit v1.2.2