From: Alexandre Courbot Date: Fri, 2 May 2014 09:32:34 +0000 (+0900) Subject: drm/nouveau/bar: only ioremap BAR3 if it exists X-Git-Tag: v4.9.8~6258^2~2^2~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=53d206bb4aadba255d20b70893ed5ba1d89f41e1;p=platform%2Fkernel%2Flinux-rpi3.git drm/nouveau/bar: only ioremap BAR3 if it exists Some chips that use system memory exclusively (e.g. GK20A) do not expose 2 BAR regions. For them only BAR1 exists, and it should be used for USERD mapping. Do not map BAR3 if its resource does not exist. Signed-off-by: Alexandre Courbot Reviewed-by: Thierry Reding Signed-off-by: Ben Skeggs --- diff --git a/drivers/gpu/drm/nouveau/core/subdev/bar/base.c b/drivers/gpu/drm/nouveau/core/subdev/bar/base.c index bdf5941..73b1ed2 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bar/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bar/base.c @@ -118,8 +118,10 @@ nouveau_bar_create_(struct nouveau_object *parent, if (ret) return ret; - bar->iomem = ioremap(nv_device_resource_start(device, 3), - nv_device_resource_len(device, 3)); + if (nv_device_resource_len(device, 3) != 0) + bar->iomem = ioremap(nv_device_resource_start(device, 3), + nv_device_resource_len(device, 3)); + return 0; }