diff options
| author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2010-01-30 09:41:00 -0500 |
|---|---|---|
| committer | Ben Skeggs <bskeggs@redhat.com> | 2010-02-10 18:52:00 -0500 |
| commit | dd19e44b28b12f7ea59ebb54d8ea18054da7f9d1 (patch) | |
| tree | b41add6f15ebf6b7666f45b1b3d7002b3f29036b /drivers | |
| parent | b1d37aa0aa43c5bf857364093ab2191acd37f2ec (diff) | |
drm/nouveau: move dereferences after null checks
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_connector.c | 7 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_object.c | 3 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_sgdma.c | 7 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nv50_crtc.c | 11 |
4 files changed, 17 insertions, 11 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 7e6d673f3a23..d2f63353ea97 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c | |||
| @@ -88,13 +88,14 @@ nouveau_connector_destroy(struct drm_connector *drm_connector) | |||
| 88 | { | 88 | { |
| 89 | struct nouveau_connector *nv_connector = | 89 | struct nouveau_connector *nv_connector = |
| 90 | nouveau_connector(drm_connector); | 90 | nouveau_connector(drm_connector); |
| 91 | struct drm_device *dev = nv_connector->base.dev; | 91 | struct drm_device *dev; |
| 92 | |||
| 93 | NV_DEBUG_KMS(dev, "\n"); | ||
| 94 | 92 | ||
| 95 | if (!nv_connector) | 93 | if (!nv_connector) |
| 96 | return; | 94 | return; |
| 97 | 95 | ||
| 96 | dev = nv_connector->base.dev; | ||
| 97 | NV_DEBUG_KMS(dev, "\n"); | ||
| 98 | |||
| 98 | kfree(nv_connector->edid); | 99 | kfree(nv_connector->edid); |
| 99 | drm_sysfs_connector_remove(drm_connector); | 100 | drm_sysfs_connector_remove(drm_connector); |
| 100 | drm_connector_cleanup(drm_connector); | 101 | drm_connector_cleanup(drm_connector); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c index 6c2cf81716df..e7c100ba63a1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_object.c +++ b/drivers/gpu/drm/nouveau/nouveau_object.c | |||
| @@ -885,11 +885,12 @@ int | |||
| 885 | nouveau_gpuobj_sw_new(struct nouveau_channel *chan, int class, | 885 | nouveau_gpuobj_sw_new(struct nouveau_channel *chan, int class, |
| 886 | struct nouveau_gpuobj **gpuobj_ret) | 886 | struct nouveau_gpuobj **gpuobj_ret) |
| 887 | { | 887 | { |
| 888 | struct drm_nouveau_private *dev_priv = chan->dev->dev_private; | 888 | struct drm_nouveau_private *dev_priv; |
| 889 | struct nouveau_gpuobj *gpuobj; | 889 | struct nouveau_gpuobj *gpuobj; |
| 890 | 890 | ||
| 891 | if (!chan || !gpuobj_ret || *gpuobj_ret != NULL) | 891 | if (!chan || !gpuobj_ret || *gpuobj_ret != NULL) |
| 892 | return -EINVAL; | 892 | return -EINVAL; |
| 893 | dev_priv = chan->dev->dev_private; | ||
| 893 | 894 | ||
| 894 | gpuobj = kzalloc(sizeof(*gpuobj), GFP_KERNEL); | 895 | gpuobj = kzalloc(sizeof(*gpuobj), GFP_KERNEL); |
| 895 | if (!gpuobj) | 896 | if (!gpuobj) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index 4c7f1e403e80..ed1590577b6c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c | |||
| @@ -54,11 +54,12 @@ static void | |||
| 54 | nouveau_sgdma_clear(struct ttm_backend *be) | 54 | nouveau_sgdma_clear(struct ttm_backend *be) |
| 55 | { | 55 | { |
| 56 | struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)be; | 56 | struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)be; |
| 57 | struct drm_device *dev = nvbe->dev; | 57 | struct drm_device *dev; |
| 58 | |||
| 59 | NV_DEBUG(nvbe->dev, "\n"); | ||
| 60 | 58 | ||
| 61 | if (nvbe && nvbe->pages) { | 59 | if (nvbe && nvbe->pages) { |
| 60 | dev = nvbe->dev; | ||
| 61 | NV_DEBUG(dev, "\n"); | ||
| 62 | |||
| 62 | if (nvbe->bound) | 63 | if (nvbe->bound) |
| 63 | be->func->unbind(be); | 64 | be->func->unbind(be); |
| 64 | 65 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c index 40b7360841f8..d1a651e3400c 100644 --- a/drivers/gpu/drm/nouveau/nv50_crtc.c +++ b/drivers/gpu/drm/nouveau/nv50_crtc.c | |||
| @@ -298,14 +298,17 @@ nv50_crtc_set_clock(struct drm_device *dev, int head, int pclk) | |||
| 298 | static void | 298 | static void |
| 299 | nv50_crtc_destroy(struct drm_crtc *crtc) | 299 | nv50_crtc_destroy(struct drm_crtc *crtc) |
| 300 | { | 300 | { |
| 301 | struct drm_device *dev = crtc->dev; | 301 | struct drm_device *dev; |
| 302 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 302 | struct nouveau_crtc *nv_crtc; |
| 303 | |||
| 304 | NV_DEBUG_KMS(dev, "\n"); | ||
| 305 | 303 | ||
| 306 | if (!crtc) | 304 | if (!crtc) |
| 307 | return; | 305 | return; |
| 308 | 306 | ||
| 307 | dev = crtc->dev; | ||
| 308 | nv_crtc = nouveau_crtc(crtc); | ||
| 309 | |||
| 310 | NV_DEBUG_KMS(dev, "\n"); | ||
| 311 | |||
| 309 | drm_crtc_cleanup(&nv_crtc->base); | 312 | drm_crtc_cleanup(&nv_crtc->base); |
| 310 | 313 | ||
| 311 | nv50_cursor_fini(nv_crtc); | 314 | nv50_cursor_fini(nv_crtc); |
