From 4b3591aafb8a53b051ce75629b15d2957943bd76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konsta=20H=C3=B6ltt=C3=A4?= Date: Wed, 9 Jun 2021 14:00:12 +0300 Subject: [PATCH] gpu: nvgpu: avoid faulty elpg protection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't store the return value of elpg re-enable if disable fails; this could make the local status value zero again, causing the elpg-protected call to be executed with elpg still enabled and elpg re-enabled twice. Commit c90585856567 ("gpu: nvgpu: add cg and pg function") introduced this bug; failure of re-enabling after a failed disable might be another problem (and it's not clear why this is done in the first place) which isn't propagated to the caller, but that would belong to another patch. Bug 200565050 Change-Id: I7cf7a0887ae59e85bf0c56c38aaaadfefd16cc1c Signed-off-by: Konsta Hölttä Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2541859 Reviewed-by: Debarshi Dutta Reviewed-by: svc_kernel_abi Reviewed-by: Deepak Nibade Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/power_features/pg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/include/nvgpu/power_features/pg.h b/drivers/gpu/nvgpu/include/nvgpu/power_features/pg.h index 674adb7f5..ad7ec0491 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/power_features/pg.h +++ b/drivers/gpu/nvgpu/include/nvgpu/power_features/pg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -34,7 +34,7 @@ struct gk20a; int err = 0; \ err = nvgpu_pg_elpg_disable(g);\ if (err != 0) {\ - err = nvgpu_pg_elpg_enable(g);\ + (void)nvgpu_pg_elpg_enable(g);\ }\ if (err == 0) { \ err = (func); \