diff options
author | Karol Herbst <karolherbst@gmail.com> | 2016-07-12 21:36:08 +0200 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2016-10-12 17:29:18 +1000 |
commit | cc90badd3c077ee18f82114988dbd53faf8f34c3 (patch) | |
tree | 75a9909abb6fe169ed1fa4c3233770771b1212e9 /drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | |
parent | a8c119a4d0af1633eb37af87c61b632646894329 (diff) | |
download | linux-cc90badd3c077ee18f82114988dbd53faf8f34c3.tar.bz2 |
drm/nouveau/clk: Fix potential NULL pointer access when there is no fb subdev
Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c index 7102c25320fc..1defd3215ed3 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c @@ -175,7 +175,7 @@ static int nvkm_pstate_prog(struct nvkm_clk *clk, int pstatei) { struct nvkm_subdev *subdev = &clk->subdev; - struct nvkm_ram *ram = subdev->device->fb->ram; + struct nvkm_fb *fb = subdev->device->fb; struct nvkm_pci *pci = subdev->device->pci; struct nvkm_pstate *pstate; int ret, idx = 0; @@ -190,7 +190,8 @@ nvkm_pstate_prog(struct nvkm_clk *clk, int pstatei) nvkm_pcie_set_link(pci, pstate->pcie_speed, pstate->pcie_width); - if (ram && ram->func->calc) { + if (fb && fb->ram && fb->ram->func->calc) { + struct nvkm_ram *ram = fb->ram; int khz = pstate->base.domain[nv_clk_src_mem]; do { ret = ram->func->calc(ram, khz); |