gpu: nvgpu: Propagate pmu initialization failures

During testing it was detected that a failure in loading the firmware
for the driver would not propagate, allowing some function pointers to
be left unitialized. This would cause a kernel-crash later on.

Bug 1866370

Change-Id: I66056a1d99229d10635293d4c1685f596f197255
Signed-off-by: David Nieto <dmartineznie@nvidia.com>
Reviewed-on: http://git-master/r/1295376
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
David Nieto
2017-01-26 14:44:54 -08:00
committed by mobile promotions
parent c71346ad94
commit 5fb7f2a262

View File

@@ -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,
@@ -173,7 +173,8 @@ static int pmu_ucode_details(struct gk20a *g, struct flcn_ucode_img_v1 *p_img)
err = gk20a_init_pmu(pmu);
if (err) {
gp106_dbg_pmu("failed to set function pointers\n");
gk20a_err(dev_from_gk20a(g),
"failed to set function pointers\n");
goto release_sig;
}
@@ -455,7 +456,9 @@ 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 (status)
return status;
if (ucode_img.lsf_desc != NULL) {
/* The falon_id is formed by grabbing the static base
* falon_id from the image and adding the
@@ -482,7 +485,6 @@ static int lsfm_discover_ucode_images(struct gk20a *g,
gp106_dbg_pmu("pmu is not LSFM managed\n");
lsfm_free_ucode_img_res(&ucode_img);
}
}
/* Enumerate all constructed falcon objects,
as we need the ucode image info and total falcon count.*/