gpu: nvgpu: posix: print WARN*() location

WARN() and WARN_ON() are most useful when the log explains where they
happened. The posix implementation of these prints neither that nor the
warning message (if any). Extend the macros to include function name and
line number, and print those plus the format string.

Actually formatting the format string is problematic wrt. MISRA rules,
so the arguments are not formatted.

The implementation of BUG() already prints the function name and line
number.

Change-Id: Ie246a915f5e8420e1c606bb1555a7f9b498725fd
Signed-off-by: Konsta Hölttä <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2634105
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Konsta Hölttä
2021-11-30 10:52:41 +02:00
committed by mobile promotions
parent 4c2e2bb0b9
commit ae166bba8a
3 changed files with 14 additions and 7 deletions

View File

@@ -164,12 +164,12 @@ int test_warn_msg(struct unit_module *m,
{
bool ret;
ret = nvgpu_posix_warn(0, "");
ret = nvgpu_posix_warn(__func__, __LINE__, 0, "");
if (ret != 0) {
unit_return_fail(m, "nvgpu_posix_warn failed for cond 0\n");
}
ret = nvgpu_posix_warn(1, "");
ret = nvgpu_posix_warn(__func__, __LINE__, 1, "");
if (ret != 1) {
unit_return_fail(m, "nvgpu_posix_warn failed for cond 1\n");
}