drm/nouveau/pci: Move a variable assignment behind condition checks in nvkm_pcie_set_...
authorMarkus Elfring <Markus.Elfring@web.de>
Sun, 16 Apr 2023 06:18:40 +0000 (08:18 +0200)
committerKarol Herbst <kherbst@redhat.com>
Mon, 17 Apr 2023 17:08:04 +0000 (19:08 +0200)
commit488c1ce6a8f3d46e20440b2e240e096a20259fcc
treebc22b79b2afac091278a3f2b81fc3fbf1a94468b
parent41239aa4f751fbc39481a4af726faa347a26da83
drm/nouveau/pci: Move a variable assignment behind condition checks in nvkm_pcie_set_link()

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

Thus avoid the risk for undefined behaviour by moving the assignment
for the variable “subdev” behind some condition checks.

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/b31019b1-bb73-ed93-3378-e551e17a4f32@web.de
drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c