Dan Carpenter
2023-Nov-07 14:34 UTC
[Nouveau] [bug report] drm/nouveau/gsp/r535: add support for booting GSP-RM
Hello Ben Skeggs, The patch 176fdcbddfd2: "drm/nouveau/gsp/r535: add support for booting GSP-RM" from Sep 19, 2023 (linux-next), leads to the following Smatch static checker warning: drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1016 r535_gsp_rpc_unloading_guest_driver() warn: 'rpc' isn't an ERR_PTR drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c 1010 static int 1011 r535_gsp_rpc_unloading_guest_driver(struct nvkm_gsp *gsp, bool suspend) 1012 { 1013 rpc_unloading_guest_driver_v1F_07 *rpc; 1014 1015 rpc = nvkm_gsp_rpc_get(gsp, NV_VGPU_MSG_FUNCTION_UNLOADING_GUEST_DRIVER, sizeof(*rpc)); nvkm_gsp_rpc_get() returns NULL on error. --> 1016 if (IS_ERR(rpc)) 1017 return PTR_ERR(rpc); 1018 1019 if (suspend) { 1020 rpc->bInPMTransition = 1; 1021 rpc->bGc6Entering = 0; 1022 rpc->newLevel = NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_3; 1023 } else { 1024 rpc->bInPMTransition = 0; 1025 rpc->bGc6Entering = 0; 1026 rpc->newLevel = NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_0; 1027 } 1028 1029 return nvkm_gsp_rpc_wr(gsp, rpc, true); 1030 } regards, dan carpenter
Philipp Stanner
2023-Nov-07 14:47 UTC
[Nouveau] [bug report] drm/nouveau/gsp/r535: add support for booting GSP-RM
On Tue, 2023-11-07 at 17:34 +0300, Dan Carpenter wrote:> Hello Ben Skeggs,Hi, FYI, Ben is not maintaining Nouveau anymore. The MAINTAINERS file has been updated in that regard. P.> > The patch 176fdcbddfd2: "drm/nouveau/gsp/r535: add support for > booting GSP-RM" from Sep 19, 2023 (linux-next), leads to the > following Smatch static checker warning: > > ????????drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1016 > r535_gsp_rpc_unloading_guest_driver() > ????????warn: 'rpc' isn't an ERR_PTR > > drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c > ??? 1010 static int > ??? 1011 r535_gsp_rpc_unloading_guest_driver(struct nvkm_gsp *gsp, > bool suspend) > ??? 1012 { > ??? 1013???????? rpc_unloading_guest_driver_v1F_07 *rpc; > ??? 1014 > ??? 1015???????? rpc = nvkm_gsp_rpc_get(gsp, > NV_VGPU_MSG_FUNCTION_UNLOADING_GUEST_DRIVER, sizeof(*rpc)); > > nvkm_gsp_rpc_get() returns NULL on error. > > --> 1016???????? if (IS_ERR(rpc)) > ??? 1017???????????????? return PTR_ERR(rpc); > ??? 1018 > ??? 1019???????? if (suspend) { > ??? 1020???????????????? rpc->bInPMTransition = 1; > ??? 1021???????????????? rpc->bGc6Entering = 0; > ??? 1022???????????????? rpc->newLevel > NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_3; > ??? 1023???????? } else { > ??? 1024???????????????? rpc->bInPMTransition = 0; > ??? 1025???????????????? rpc->bGc6Entering = 0; > ??? 1026???????????????? rpc->newLevel > NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_0; > ??? 1027???????? } > ??? 1028 > ??? 1029???????? return nvkm_gsp_rpc_wr(gsp, rpc, true); > ??? 1030 } > > regards, > dan carpenter >
Dan Carpenter
2023-Nov-07 15:20 UTC
[Nouveau] [bug report] drm/nouveau/gsp/r535: add support for booting GSP-RM
On Tue, Nov 07, 2023 at 05:34:43PM +0300, Dan Carpenter wrote:> Hello Ben Skeggs, > > The patch 176fdcbddfd2: "drm/nouveau/gsp/r535: add support for > booting GSP-RM" from Sep 19, 2023 (linux-next), leads to the > following Smatch static checker warning: > > drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1016 r535_gsp_rpc_unloading_guest_driver() > warn: 'rpc' isn't an ERR_PTRSome related bugs are: drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1058 r535_gsp_rpc_set_registry() warn: 'rpc' isn't an ERR_PTR drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1273 r535_gsp_rpc_set_system_info() warn: 'info' isn't an ERR_PTR drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:611 r535_gsp_rpc_rm_alloc_get() warn: 'rpc' isn't an ERR_PTR drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:667 r535_gsp_rpc_rm_ctrl_get() warn: 'rpc' isn't an ERR_PTR drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:692 r535_gsp_rpc_get() warn: 'rpc' is an error pointer or valid drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:695 r535_gsp_rpc_get() error: 'rpc' dereferencing possible ERR_PTR() drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:735 r535_gsp_rpc_push() warn: 'next' isn't an ERR_PTR drivers/gpu/drm/nouveau/nvkm/subdev/instmem/r535.c:69 fbsr_memlist() warn: 'rpc' isn't an ERR_PTR regards, dan carpenter
Danilo Krummrich
2023-Nov-07 19:00 UTC
[Nouveau] [bug report] drm/nouveau/gsp/r535: add support for booting GSP-RM
On 11/7/23 15:34, Dan Carpenter wrote:> Hello Ben Skeggs, > > The patch 176fdcbddfd2: "drm/nouveau/gsp/r535: add support for > booting GSP-RM" from Sep 19, 2023 (linux-next), leads to the > following Smatch static checker warning: > > drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1016 r535_gsp_rpc_unloading_guest_driver() > warn: 'rpc' isn't an ERR_PTR > > drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c > 1010 static int > 1011 r535_gsp_rpc_unloading_guest_driver(struct nvkm_gsp *gsp, bool suspend) > 1012 { > 1013 rpc_unloading_guest_driver_v1F_07 *rpc; > 1014 > 1015 rpc = nvkm_gsp_rpc_get(gsp, NV_VGPU_MSG_FUNCTION_UNLOADING_GUEST_DRIVER, sizeof(*rpc)); > > nvkm_gsp_rpc_get() returns NULL on error.There are also code paths where it can return an ERR_PTR. I think we need to check for IS_ERR_OR_NULL()...> > --> 1016 if (IS_ERR(rpc)) > 1017 return PTR_ERR(rpc); > 1018 > 1019 if (suspend) { > 1020 rpc->bInPMTransition = 1; > 1021 rpc->bGc6Entering = 0; > 1022 rpc->newLevel = NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_3; > 1023 } else { > 1024 rpc->bInPMTransition = 0; > 1025 rpc->bGc6Entering = 0; > 1026 rpc->newLevel = NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_0; > 1027 } > 1028 > 1029 return nvkm_gsp_rpc_wr(gsp, rpc, true); > 1030 } > > regards, > dan carpenter