diff options
author | Dave Airlie <airlied@redhat.com> | 2016-06-15 02:58:32 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-06-15 02:58:32 -0400 |
commit | e43fc9467e96bbaf1b65bb975e6820e0db993469 (patch) | |
tree | c0b77745c92adafdf28ab9ea7d0d9a871e17372a | |
parent | fd2d2bac6e79b0be91ab86a6075a0c46ffda658a (diff) | |
parent | 6aa85f1129b32b5cd19ec262e7cfc2ddc08263c3 (diff) |
Merge branch 'linux-4.7' of git://github.com/skeggsb/linux into drm-fixes
* 'linux-4.7' of git://github.com/skeggsb/linux:
drm/nouveau/iccsense: fix memory leak
drm/nouveau/Revert "drm/nouveau/device/pci: set as non-CPU-coherent on ARM64"
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c | 16 |
2 files changed, 10 insertions, 8 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c index 18fab3973ce5..62ad0300cfa5 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c | |||
@@ -1614,7 +1614,7 @@ nvkm_device_pci_func = { | |||
1614 | .fini = nvkm_device_pci_fini, | 1614 | .fini = nvkm_device_pci_fini, |
1615 | .resource_addr = nvkm_device_pci_resource_addr, | 1615 | .resource_addr = nvkm_device_pci_resource_addr, |
1616 | .resource_size = nvkm_device_pci_resource_size, | 1616 | .resource_size = nvkm_device_pci_resource_size, |
1617 | .cpu_coherent = !IS_ENABLED(CONFIG_ARM) && !IS_ENABLED(CONFIG_ARM64), | 1617 | .cpu_coherent = !IS_ENABLED(CONFIG_ARM), |
1618 | }; | 1618 | }; |
1619 | 1619 | ||
1620 | int | 1620 | int |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c index 323c79abe468..41bd5d0f7692 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c | |||
@@ -276,6 +276,8 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev) | |||
276 | struct pwr_rail_t *r = &stbl.rail[i]; | 276 | struct pwr_rail_t *r = &stbl.rail[i]; |
277 | struct nvkm_iccsense_rail *rail; | 277 | struct nvkm_iccsense_rail *rail; |
278 | struct nvkm_iccsense_sensor *sensor; | 278 | struct nvkm_iccsense_sensor *sensor; |
279 | int (*read)(struct nvkm_iccsense *, | ||
280 | struct nvkm_iccsense_rail *); | ||
279 | 281 | ||
280 | if (!r->mode || r->resistor_mohm == 0) | 282 | if (!r->mode || r->resistor_mohm == 0) |
281 | continue; | 283 | continue; |
@@ -284,31 +286,31 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev) | |||
284 | if (!sensor) | 286 | if (!sensor) |
285 | continue; | 287 | continue; |
286 | 288 | ||
287 | rail = kmalloc(sizeof(*rail), GFP_KERNEL); | ||
288 | if (!rail) | ||
289 | return -ENOMEM; | ||
290 | |||
291 | switch (sensor->type) { | 289 | switch (sensor->type) { |
292 | case NVBIOS_EXTDEV_INA209: | 290 | case NVBIOS_EXTDEV_INA209: |
293 | if (r->rail != 0) | 291 | if (r->rail != 0) |
294 | continue; | 292 | continue; |
295 | rail->read = nvkm_iccsense_ina209_read; | 293 | read = nvkm_iccsense_ina209_read; |
296 | break; | 294 | break; |
297 | case NVBIOS_EXTDEV_INA219: | 295 | case NVBIOS_EXTDEV_INA219: |
298 | if (r->rail != 0) | 296 | if (r->rail != 0) |
299 | continue; | 297 | continue; |
300 | rail->read = nvkm_iccsense_ina219_read; | 298 | read = nvkm_iccsense_ina219_read; |
301 | break; | 299 | break; |
302 | case NVBIOS_EXTDEV_INA3221: | 300 | case NVBIOS_EXTDEV_INA3221: |
303 | if (r->rail >= 3) | 301 | if (r->rail >= 3) |
304 | continue; | 302 | continue; |
305 | rail->read = nvkm_iccsense_ina3221_read; | 303 | read = nvkm_iccsense_ina3221_read; |
306 | break; | 304 | break; |
307 | default: | 305 | default: |
308 | continue; | 306 | continue; |
309 | } | 307 | } |
310 | 308 | ||
309 | rail = kmalloc(sizeof(*rail), GFP_KERNEL); | ||
310 | if (!rail) | ||
311 | return -ENOMEM; | ||
311 | sensor->rail_mask |= 1 << r->rail; | 312 | sensor->rail_mask |= 1 << r->rail; |
313 | rail->read = read; | ||
312 | rail->sensor = sensor; | 314 | rail->sensor = sensor; |
313 | rail->idx = r->rail; | 315 | rail->idx = r->rail; |
314 | rail->mohm = r->resistor_mohm; | 316 | rail->mohm = r->resistor_mohm; |