diff options
author | Dave Airlie <airlied@redhat.com> | 2014-08-14 19:29:35 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2014-08-14 19:29:35 -0400 |
commit | 83d45f234d7c20feefe9c4417e157948c97f511c (patch) | |
tree | 294b2a999fb15a229fef98343f3a07eae4a8098c | |
parent | 899552d6e84babd24611fd36ac7051068cb1eb2d (diff) | |
parent | 4898ac046d24894d7b2a5a96a1cff4e095844323 (diff) |
Merge branch 'linux-3.17' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-fixes
A couple of thinkos from the -next merge, some random fixes from a
coverity scan, fix for (at least) GK106 accidentally using
non-existent vram on some board configurations, and better behaviour
of the instmem allocations if vmalloc space runs out.
* 'linux-3.17' of git://anongit.freedesktop.org/git/nouveau/linux-2.6:
drm/nouveau/platform: fix compilation error
drm/nouveau/gk20a: add LTC device
drm/nouveau: warn if we fail to re-pin fb on resume
drm/nouveau/nvif: fix dac load detect method definition
drm/gf100-/gr: fix -ENOSPC detection when allocating zbc table entries
drm/nouveau/nvif: return null pointers on failure, in addition to ret != 0
drm/nouveau/ltc: fix tag base address getting truncated if above 4GiB
drm/nvc0-/fb/ram: fix use of non-existant ram if partitions aren't uniform
drm/nouveau/bar: behave better if ioremap failed
drm/nouveau/kms: nouveau_fbcon_accel_fini can be static
drm/nouveau: kill unused variable warning if !__OS_HAS_AGP
drm/nouveau/nvif: fix a number of notify thinkos
-rw-r--r-- | drivers/gpu/drm/nouveau/core/core/client.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/device/nve0.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/include/core/client.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/bar/base.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bo.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_display.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_fbcon.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_platform.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/class.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/notify.c | 29 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/object.c | 4 |
14 files changed, 57 insertions, 27 deletions
diff --git a/drivers/gpu/drm/nouveau/core/core/client.c b/drivers/gpu/drm/nouveau/core/core/client.c index 10598dede9e9..68bf06768123 100644 --- a/drivers/gpu/drm/nouveau/core/core/client.c +++ b/drivers/gpu/drm/nouveau/core/core/client.c | |||
@@ -132,12 +132,12 @@ nvkm_client_notify_new(struct nouveau_client *client, | |||
132 | if (ret == 0) { | 132 | if (ret == 0) { |
133 | client->notify[index] = notify; | 133 | client->notify[index] = notify; |
134 | notify->client = client; | 134 | notify->client = client; |
135 | return 0; | 135 | return index; |
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | kfree(notify); | 139 | kfree(notify); |
140 | return 0; | 140 | return ret; |
141 | } | 141 | } |
142 | 142 | ||
143 | static int | 143 | static int |
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/nve0.c b/drivers/gpu/drm/nouveau/core/engine/device/nve0.c index 54ec53bc6252..cdf9147f32a1 100644 --- a/drivers/gpu/drm/nouveau/core/engine/device/nve0.c +++ b/drivers/gpu/drm/nouveau/core/engine/device/nve0.c | |||
@@ -163,6 +163,7 @@ nve0_identify(struct nouveau_device *device) | |||
163 | device->oclass[NVDEV_SUBDEV_BUS ] = nvc0_bus_oclass; | 163 | device->oclass[NVDEV_SUBDEV_BUS ] = nvc0_bus_oclass; |
164 | device->oclass[NVDEV_SUBDEV_TIMER ] = &gk20a_timer_oclass; | 164 | device->oclass[NVDEV_SUBDEV_TIMER ] = &gk20a_timer_oclass; |
165 | device->oclass[NVDEV_SUBDEV_FB ] = gk20a_fb_oclass; | 165 | device->oclass[NVDEV_SUBDEV_FB ] = gk20a_fb_oclass; |
166 | device->oclass[NVDEV_SUBDEV_LTC ] = gk104_ltc_oclass; | ||
166 | device->oclass[NVDEV_SUBDEV_IBUS ] = &gk20a_ibus_oclass; | 167 | device->oclass[NVDEV_SUBDEV_IBUS ] = &gk20a_ibus_oclass; |
167 | device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; | 168 | device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; |
168 | device->oclass[NVDEV_SUBDEV_VM ] = &nvc0_vmmgr_oclass; | 169 | device->oclass[NVDEV_SUBDEV_VM ] = &nvc0_vmmgr_oclass; |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c index db19191176fa..30fd1dc64f93 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c | |||
@@ -68,6 +68,9 @@ nvc0_graph_zbc_color_get(struct nvc0_graph_priv *priv, int format, | |||
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | if (zbc < 0) | ||
72 | return zbc; | ||
73 | |||
71 | memcpy(priv->zbc_color[zbc].ds, ds, sizeof(priv->zbc_color[zbc].ds)); | 74 | memcpy(priv->zbc_color[zbc].ds, ds, sizeof(priv->zbc_color[zbc].ds)); |
72 | memcpy(priv->zbc_color[zbc].l2, l2, sizeof(priv->zbc_color[zbc].l2)); | 75 | memcpy(priv->zbc_color[zbc].l2, l2, sizeof(priv->zbc_color[zbc].l2)); |
73 | priv->zbc_color[zbc].format = format; | 76 | priv->zbc_color[zbc].format = format; |
@@ -109,6 +112,9 @@ nvc0_graph_zbc_depth_get(struct nvc0_graph_priv *priv, int format, | |||
109 | } | 112 | } |
110 | } | 113 | } |
111 | 114 | ||
115 | if (zbc < 0) | ||
116 | return zbc; | ||
117 | |||
112 | priv->zbc_depth[zbc].format = format; | 118 | priv->zbc_depth[zbc].format = format; |
113 | priv->zbc_depth[zbc].ds = ds; | 119 | priv->zbc_depth[zbc].ds = ds; |
114 | priv->zbc_depth[zbc].l2 = l2; | 120 | priv->zbc_depth[zbc].l2 = l2; |
diff --git a/drivers/gpu/drm/nouveau/core/include/core/client.h b/drivers/gpu/drm/nouveau/core/include/core/client.h index 4fc6ab12382d..1794a05205d8 100644 --- a/drivers/gpu/drm/nouveau/core/include/core/client.h +++ b/drivers/gpu/drm/nouveau/core/include/core/client.h | |||
@@ -14,7 +14,7 @@ struct nouveau_client { | |||
14 | void *data; | 14 | void *data; |
15 | 15 | ||
16 | int (*ntfy)(const void *, u32, const void *, u32); | 16 | int (*ntfy)(const void *, u32, const void *, u32); |
17 | struct nvkm_client_notify *notify[8]; | 17 | struct nvkm_client_notify *notify[16]; |
18 | }; | 18 | }; |
19 | 19 | ||
20 | static inline struct nouveau_client * | 20 | static inline struct nouveau_client * |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bar/base.c b/drivers/gpu/drm/nouveau/core/subdev/bar/base.c index 73b1ed20c8d5..8bcbdf39cfb2 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bar/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bar/base.c | |||
@@ -99,8 +99,13 @@ nouveau_bar_alloc(struct nouveau_bar *bar, struct nouveau_object *parent, | |||
99 | struct nouveau_mem *mem, struct nouveau_object **pobject) | 99 | struct nouveau_mem *mem, struct nouveau_object **pobject) |
100 | { | 100 | { |
101 | struct nouveau_object *engine = nv_object(bar); | 101 | struct nouveau_object *engine = nv_object(bar); |
102 | return nouveau_object_ctor(parent, engine, &nouveau_barobj_oclass, | 102 | int ret = -ENOMEM; |
103 | mem, 0, pobject); | 103 | if (bar->iomem) { |
104 | ret = nouveau_object_ctor(parent, engine, | ||
105 | &nouveau_barobj_oclass, | ||
106 | mem, 0, pobject); | ||
107 | } | ||
108 | return ret; | ||
104 | } | 109 | } |
105 | 110 | ||
106 | int | 111 | int |
@@ -118,9 +123,12 @@ nouveau_bar_create_(struct nouveau_object *parent, | |||
118 | if (ret) | 123 | if (ret) |
119 | return ret; | 124 | return ret; |
120 | 125 | ||
121 | if (nv_device_resource_len(device, 3) != 0) | 126 | if (nv_device_resource_len(device, 3) != 0) { |
122 | bar->iomem = ioremap(nv_device_resource_start(device, 3), | 127 | bar->iomem = ioremap(nv_device_resource_start(device, 3), |
123 | nv_device_resource_len(device, 3)); | 128 | nv_device_resource_len(device, 3)); |
129 | if (!bar->iomem) | ||
130 | nv_warn(bar, "PRAMIN ioremap failed\n"); | ||
131 | } | ||
124 | 132 | ||
125 | return 0; | 133 | return 0; |
126 | } | 134 | } |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c index 946518572346..2b284b192763 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c | |||
@@ -554,13 +554,13 @@ nvc0_ram_create_(struct nouveau_object *parent, struct nouveau_object *engine, | |||
554 | } else { | 554 | } else { |
555 | /* otherwise, address lowest common amount from 0GiB */ | 555 | /* otherwise, address lowest common amount from 0GiB */ |
556 | ret = nouveau_mm_init(&pfb->vram, rsvd_head, | 556 | ret = nouveau_mm_init(&pfb->vram, rsvd_head, |
557 | (bsize << 8) * parts, 1); | 557 | (bsize << 8) * parts - rsvd_head, 1); |
558 | if (ret) | 558 | if (ret) |
559 | return ret; | 559 | return ret; |
560 | 560 | ||
561 | /* and the rest starting from (8GiB + common_size) */ | 561 | /* and the rest starting from (8GiB + common_size) */ |
562 | offset = (0x0200000000ULL >> 12) + (bsize << 8); | 562 | offset = (0x0200000000ULL >> 12) + (bsize << 8); |
563 | length = (ram->size >> 12) - (bsize << 8) - rsvd_tail; | 563 | length = (ram->size >> 12) - ((bsize * parts) << 8) - rsvd_tail; |
564 | 564 | ||
565 | ret = nouveau_mm_init(&pfb->vram, offset, length, 0); | 565 | ret = nouveau_mm_init(&pfb->vram, offset, length, 0); |
566 | if (ret) | 566 | if (ret) |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c index 9e00a1ede120..b54b582e72c4 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c +++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c | |||
@@ -156,7 +156,7 @@ gf100_ltc_init_tag_ram(struct nouveau_fb *pfb, struct nvkm_ltc_priv *priv) | |||
156 | if (ret) { | 156 | if (ret) { |
157 | priv->num_tags = 0; | 157 | priv->num_tags = 0; |
158 | } else { | 158 | } else { |
159 | u64 tag_base = (priv->tag_ram->offset << 12) + tag_margin; | 159 | u64 tag_base = ((u64)priv->tag_ram->offset << 12) + tag_margin; |
160 | 160 | ||
161 | tag_base += tag_align - 1; | 161 | tag_base += tag_align - 1; |
162 | ret = do_div(tag_base, tag_align); | 162 | ret = do_div(tag_base, tag_align); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index da5d631aa5b9..01da508625f2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -1228,7 +1228,6 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem) | |||
1228 | struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type]; | 1228 | struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type]; |
1229 | struct nouveau_drm *drm = nouveau_bdev(bdev); | 1229 | struct nouveau_drm *drm = nouveau_bdev(bdev); |
1230 | struct nouveau_mem *node = mem->mm_node; | 1230 | struct nouveau_mem *node = mem->mm_node; |
1231 | struct drm_device *dev = drm->dev; | ||
1232 | int ret; | 1231 | int ret; |
1233 | 1232 | ||
1234 | mem->bus.addr = NULL; | 1233 | mem->bus.addr = NULL; |
@@ -1247,7 +1246,7 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem) | |||
1247 | if (drm->agp.stat == ENABLED) { | 1246 | if (drm->agp.stat == ENABLED) { |
1248 | mem->bus.offset = mem->start << PAGE_SHIFT; | 1247 | mem->bus.offset = mem->start << PAGE_SHIFT; |
1249 | mem->bus.base = drm->agp.base; | 1248 | mem->bus.base = drm->agp.base; |
1250 | mem->bus.is_iomem = !dev->agp->cant_use_aperture; | 1249 | mem->bus.is_iomem = !drm->dev->agp->cant_use_aperture; |
1251 | } | 1250 | } |
1252 | #endif | 1251 | #endif |
1253 | if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA || !node->memtype) | 1252 | if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA || !node->memtype) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 1cc7b603c753..65b4fd53dd4e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -592,7 +592,9 @@ nouveau_display_repin(struct drm_device *dev) | |||
592 | if (!nouveau_fb || !nouveau_fb->nvbo) | 592 | if (!nouveau_fb || !nouveau_fb->nvbo) |
593 | continue; | 593 | continue; |
594 | 594 | ||
595 | nouveau_bo_pin(nouveau_fb->nvbo, TTM_PL_FLAG_VRAM); | 595 | ret = nouveau_bo_pin(nouveau_fb->nvbo, TTM_PL_FLAG_VRAM); |
596 | if (ret) | ||
597 | NV_ERROR(drm, "Could not pin framebuffer\n"); | ||
596 | } | 598 | } |
597 | 599 | ||
598 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 600 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index ebfe3180109e..8bdd27091db8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -226,7 +226,7 @@ nouveau_fbcon_accel_restore(struct drm_device *dev) | |||
226 | } | 226 | } |
227 | } | 227 | } |
228 | 228 | ||
229 | void | 229 | static void |
230 | nouveau_fbcon_accel_fini(struct drm_device *dev) | 230 | nouveau_fbcon_accel_fini(struct drm_device *dev) |
231 | { | 231 | { |
232 | struct nouveau_drm *drm = nouveau_drm(dev); | 232 | struct nouveau_drm *drm = nouveau_drm(dev); |
@@ -246,7 +246,7 @@ nouveau_fbcon_accel_fini(struct drm_device *dev) | |||
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | void | 249 | static void |
250 | nouveau_fbcon_accel_init(struct drm_device *dev) | 250 | nouveau_fbcon_accel_init(struct drm_device *dev) |
251 | { | 251 | { |
252 | struct nouveau_drm *drm = nouveau_drm(dev); | 252 | struct nouveau_drm *drm = nouveau_drm(dev); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_platform.c b/drivers/gpu/drm/nouveau/nouveau_platform.c index 0ffeb50d0088..246a824c16ca 100644 --- a/drivers/gpu/drm/nouveau/nouveau_platform.c +++ b/drivers/gpu/drm/nouveau/nouveau_platform.c | |||
@@ -149,7 +149,8 @@ power_down: | |||
149 | static int nouveau_platform_remove(struct platform_device *pdev) | 149 | static int nouveau_platform_remove(struct platform_device *pdev) |
150 | { | 150 | { |
151 | struct drm_device *drm_dev = platform_get_drvdata(pdev); | 151 | struct drm_device *drm_dev = platform_get_drvdata(pdev); |
152 | struct nouveau_device *device = nouveau_dev(drm_dev); | 152 | struct nouveau_drm *drm = nouveau_drm(drm_dev); |
153 | struct nouveau_device *device = nvkm_device(&drm->device); | ||
153 | struct nouveau_platform_gpu *gpu = nv_device_to_platform(device)->gpu; | 154 | struct nouveau_platform_gpu *gpu = nv_device_to_platform(device)->gpu; |
154 | 155 | ||
155 | nouveau_drm_device_remove(drm_dev); | 156 | nouveau_drm_device_remove(drm_dev); |
diff --git a/drivers/gpu/drm/nouveau/nvif/class.h b/drivers/gpu/drm/nouveau/nvif/class.h index cc81e0e5fd30..573491f84792 100644 --- a/drivers/gpu/drm/nouveau/nvif/class.h +++ b/drivers/gpu/drm/nouveau/nvif/class.h | |||
@@ -428,8 +428,8 @@ struct nv50_disp_dac_pwr_v0 { | |||
428 | struct nv50_disp_dac_load_v0 { | 428 | struct nv50_disp_dac_load_v0 { |
429 | __u8 version; | 429 | __u8 version; |
430 | __u8 load; | 430 | __u8 load; |
431 | __u16 data; | 431 | __u8 pad02[2]; |
432 | __u8 pad04[4]; | 432 | __u32 data; |
433 | }; | 433 | }; |
434 | 434 | ||
435 | struct nv50_disp_sor_pwr_v0 { | 435 | struct nv50_disp_sor_pwr_v0 { |
diff --git a/drivers/gpu/drm/nouveau/nvif/notify.c b/drivers/gpu/drm/nouveau/nvif/notify.c index 7c06123a559c..0898c3155292 100644 --- a/drivers/gpu/drm/nouveau/nvif/notify.c +++ b/drivers/gpu/drm/nouveau/nvif/notify.c | |||
@@ -87,12 +87,25 @@ nvif_notify_get(struct nvif_notify *notify) | |||
87 | return 0; | 87 | return 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | static inline int | ||
91 | nvif_notify_func(struct nvif_notify *notify, bool keep) | ||
92 | { | ||
93 | int ret = notify->func(notify); | ||
94 | if (ret == NVIF_NOTIFY_KEEP || | ||
95 | !test_and_clear_bit(NVKM_NOTIFY_USER, ¬ify->flags)) { | ||
96 | if (!keep) | ||
97 | atomic_dec(¬ify->putcnt); | ||
98 | else | ||
99 | nvif_notify_get_(notify); | ||
100 | } | ||
101 | return ret; | ||
102 | } | ||
103 | |||
90 | static void | 104 | static void |
91 | nvif_notify_work(struct work_struct *work) | 105 | nvif_notify_work(struct work_struct *work) |
92 | { | 106 | { |
93 | struct nvif_notify *notify = container_of(work, typeof(*notify), work); | 107 | struct nvif_notify *notify = container_of(work, typeof(*notify), work); |
94 | if (notify->func(notify) == NVIF_NOTIFY_KEEP) | 108 | nvif_notify_func(notify, true); |
95 | nvif_notify_get_(notify); | ||
96 | } | 109 | } |
97 | 110 | ||
98 | int | 111 | int |
@@ -113,19 +126,15 @@ nvif_notify(const void *header, u32 length, const void *data, u32 size) | |||
113 | if (!WARN_ON(notify == NULL)) { | 126 | if (!WARN_ON(notify == NULL)) { |
114 | struct nvif_client *client = nvif_client(notify->object); | 127 | struct nvif_client *client = nvif_client(notify->object); |
115 | if (!WARN_ON(notify->size != size)) { | 128 | if (!WARN_ON(notify->size != size)) { |
129 | atomic_inc(¬ify->putcnt); | ||
116 | if (test_bit(NVIF_NOTIFY_WORK, ¬ify->flags)) { | 130 | if (test_bit(NVIF_NOTIFY_WORK, ¬ify->flags)) { |
117 | atomic_inc(¬ify->putcnt); | ||
118 | memcpy((void *)notify->data, data, size); | 131 | memcpy((void *)notify->data, data, size); |
119 | schedule_work(¬ify->work); | 132 | schedule_work(¬ify->work); |
120 | return NVIF_NOTIFY_DROP; | 133 | return NVIF_NOTIFY_DROP; |
121 | } | 134 | } |
122 | notify->data = data; | 135 | notify->data = data; |
123 | ret = notify->func(notify); | 136 | ret = nvif_notify_func(notify, client->driver->keep); |
124 | notify->data = NULL; | 137 | notify->data = NULL; |
125 | if (ret != NVIF_NOTIFY_DROP && client->driver->keep) { | ||
126 | atomic_inc(¬ify->putcnt); | ||
127 | nvif_notify_get_(notify); | ||
128 | } | ||
129 | } | 138 | } |
130 | } | 139 | } |
131 | 140 | ||
@@ -228,8 +237,10 @@ nvif_notify_new(struct nvif_object *object, int (*func)(struct nvif_notify *), | |||
228 | if (notify) { | 237 | if (notify) { |
229 | int ret = nvif_notify_init(object, nvif_notify_del, func, work, | 238 | int ret = nvif_notify_init(object, nvif_notify_del, func, work, |
230 | type, data, size, reply, notify); | 239 | type, data, size, reply, notify); |
231 | if (ret) | 240 | if (ret) { |
232 | kfree(notify); | 241 | kfree(notify); |
242 | notify = NULL; | ||
243 | } | ||
233 | *pnotify = notify; | 244 | *pnotify = notify; |
234 | return ret; | 245 | return ret; |
235 | } | 246 | } |
diff --git a/drivers/gpu/drm/nouveau/nvif/object.c b/drivers/gpu/drm/nouveau/nvif/object.c index b0c82206ece2..dd85b56f6aa5 100644 --- a/drivers/gpu/drm/nouveau/nvif/object.c +++ b/drivers/gpu/drm/nouveau/nvif/object.c | |||
@@ -275,8 +275,10 @@ nvif_object_new(struct nvif_object *parent, u32 handle, u32 oclass, | |||
275 | if (object) { | 275 | if (object) { |
276 | int ret = nvif_object_init(parent, nvif_object_del, handle, | 276 | int ret = nvif_object_init(parent, nvif_object_del, handle, |
277 | oclass, data, size, object); | 277 | oclass, data, size, object); |
278 | if (ret) | 278 | if (ret) { |
279 | kfree(object); | 279 | kfree(object); |
280 | object = NULL; | ||
281 | } | ||
280 | *pobject = object; | 282 | *pobject = object; |
281 | return ret; | 283 | return ret; |
282 | } | 284 | } |