mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-11-22 11:10:39 +00:00
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
This commit is contained in:
parent
41239aa4f7
commit
488c1ce6a8
@ -114,7 +114,7 @@ nvkm_pcie_init(struct nvkm_pci *pci)
|
|||||||
int
|
int
|
||||||
nvkm_pcie_set_link(struct nvkm_pci *pci, enum nvkm_pcie_speed speed, u8 width)
|
nvkm_pcie_set_link(struct nvkm_pci *pci, enum nvkm_pcie_speed speed, u8 width)
|
||||||
{
|
{
|
||||||
struct nvkm_subdev *subdev = &pci->subdev;
|
struct nvkm_subdev *subdev;
|
||||||
enum nvkm_pcie_speed cur_speed, max_speed;
|
enum nvkm_pcie_speed cur_speed, max_speed;
|
||||||
struct pci_bus *pbus;
|
struct pci_bus *pbus;
|
||||||
int ret;
|
int ret;
|
||||||
@ -126,6 +126,7 @@ nvkm_pcie_set_link(struct nvkm_pci *pci, enum nvkm_pcie_speed speed, u8 width)
|
|||||||
if (!pci->func->pcie.set_link)
|
if (!pci->func->pcie.set_link)
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
|
|
||||||
|
subdev = &pci->subdev;
|
||||||
nvkm_trace(subdev, "requested %s\n", nvkm_pcie_speeds[speed]);
|
nvkm_trace(subdev, "requested %s\n", nvkm_pcie_speeds[speed]);
|
||||||
|
|
||||||
if (pci->func->pcie.version(pci) < 2) {
|
if (pci->func->pcie.version(pci) < 2) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user