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>
This commit is contained in:
parent
b1d37aa0aa
commit
dd19e44b28
|
@ -88,13 +88,14 @@ nouveau_connector_destroy(struct drm_connector *drm_connector)
|
||||||
{
|
{
|
||||||
struct nouveau_connector *nv_connector =
|
struct nouveau_connector *nv_connector =
|
||||||
nouveau_connector(drm_connector);
|
nouveau_connector(drm_connector);
|
||||||
struct drm_device *dev = nv_connector->base.dev;
|
struct drm_device *dev;
|
||||||
|
|
||||||
NV_DEBUG_KMS(dev, "\n");
|
|
||||||
|
|
||||||
if (!nv_connector)
|
if (!nv_connector)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
dev = nv_connector->base.dev;
|
||||||
|
NV_DEBUG_KMS(dev, "\n");
|
||||||
|
|
||||||
kfree(nv_connector->edid);
|
kfree(nv_connector->edid);
|
||||||
drm_sysfs_connector_remove(drm_connector);
|
drm_sysfs_connector_remove(drm_connector);
|
||||||
drm_connector_cleanup(drm_connector);
|
drm_connector_cleanup(drm_connector);
|
||||||
|
|
|
@ -885,11 +885,12 @@ int
|
||||||
nouveau_gpuobj_sw_new(struct nouveau_channel *chan, int class,
|
nouveau_gpuobj_sw_new(struct nouveau_channel *chan, int class,
|
||||||
struct nouveau_gpuobj **gpuobj_ret)
|
struct nouveau_gpuobj **gpuobj_ret)
|
||||||
{
|
{
|
||||||
struct drm_nouveau_private *dev_priv = chan->dev->dev_private;
|
struct drm_nouveau_private *dev_priv;
|
||||||
struct nouveau_gpuobj *gpuobj;
|
struct nouveau_gpuobj *gpuobj;
|
||||||
|
|
||||||
if (!chan || !gpuobj_ret || *gpuobj_ret != NULL)
|
if (!chan || !gpuobj_ret || *gpuobj_ret != NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
dev_priv = chan->dev->dev_private;
|
||||||
|
|
||||||
gpuobj = kzalloc(sizeof(*gpuobj), GFP_KERNEL);
|
gpuobj = kzalloc(sizeof(*gpuobj), GFP_KERNEL);
|
||||||
if (!gpuobj)
|
if (!gpuobj)
|
||||||
|
|
|
@ -54,11 +54,12 @@ static void
|
||||||
nouveau_sgdma_clear(struct ttm_backend *be)
|
nouveau_sgdma_clear(struct ttm_backend *be)
|
||||||
{
|
{
|
||||||
struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)be;
|
struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)be;
|
||||||
struct drm_device *dev = nvbe->dev;
|
struct drm_device *dev;
|
||||||
|
|
||||||
NV_DEBUG(nvbe->dev, "\n");
|
|
||||||
|
|
||||||
if (nvbe && nvbe->pages) {
|
if (nvbe && nvbe->pages) {
|
||||||
|
dev = nvbe->dev;
|
||||||
|
NV_DEBUG(dev, "\n");
|
||||||
|
|
||||||
if (nvbe->bound)
|
if (nvbe->bound)
|
||||||
be->func->unbind(be);
|
be->func->unbind(be);
|
||||||
|
|
||||||
|
|
|
@ -298,14 +298,17 @@ nv50_crtc_set_clock(struct drm_device *dev, int head, int pclk)
|
||||||
static void
|
static void
|
||||||
nv50_crtc_destroy(struct drm_crtc *crtc)
|
nv50_crtc_destroy(struct drm_crtc *crtc)
|
||||||
{
|
{
|
||||||
struct drm_device *dev = crtc->dev;
|
struct drm_device *dev;
|
||||||
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
|
struct nouveau_crtc *nv_crtc;
|
||||||
|
|
||||||
NV_DEBUG_KMS(dev, "\n");
|
|
||||||
|
|
||||||
if (!crtc)
|
if (!crtc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
dev = crtc->dev;
|
||||||
|
nv_crtc = nouveau_crtc(crtc);
|
||||||
|
|
||||||
|
NV_DEBUG_KMS(dev, "\n");
|
||||||
|
|
||||||
drm_crtc_cleanup(&nv_crtc->base);
|
drm_crtc_cleanup(&nv_crtc->base);
|
||||||
|
|
||||||
nv50_cursor_fini(nv_crtc);
|
nv50_cursor_fini(nv_crtc);
|
||||||
|
|
Loading…
Reference in a new issue