drm/nouveau/clk: Move a variable assignment behind a null pointer check in nvkm_pstat...
authorMarkus Elfring <Markus.Elfring@web.de>
Sun, 16 Apr 2023 05:45:54 +0000 (07:45 +0200)
committerKarol Herbst <kherbst@redhat.com>
Mon, 17 Apr 2023 17:08:03 +0000 (19:08 +0200)
commit41239aa4f751fbc39481a4af726faa347a26da83
treeaa15e280d142cf87b5edc80dc5c3954b081590fc
parent5149545dbcbb15105312014201b9c0aa859c6044
drm/nouveau/clk: Move a variable assignment behind a null pointer check in nvkm_pstate_new()

The address of a data structure member was determined before
a corresponding null pointer check in the implementation of
the function “nvkm_pstate_new”.

Thus avoid the risk for undefined behaviour by moving the assignment
for the variable “cstate” behind the null pointer check.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/6435d829-2c9b-a3f7-c8cd-cf923508a092@web.de
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c