From: Thierry Reding Date: Tue, 3 Sep 2013 06:50:39 +0000 (+0200) Subject: gpu: host1x: Check for valid host1x pointer X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=03c961ba6d04786c8a7e7df118538a01f442e90b;p=openwrt%2Fstaging%2Fblogic.git gpu: host1x: Check for valid host1x pointer Under rare circumstances it can happen that the host1x driver's .probe() doesn't finish properly, in which case the device's driver-specific data will not be set. Instead of crashing in such a situation, propagate the error to callers of the host1x_get_drm_data() function. Signed-off-by: Thierry Reding --- diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c index 28e28a23d444..471630299878 100644 --- a/drivers/gpu/host1x/dev.c +++ b/drivers/gpu/host1x/dev.c @@ -43,7 +43,7 @@ void host1x_set_drm_data(struct device *dev, void *data) void *host1x_get_drm_data(struct device *dev) { struct host1x *host1x = dev_get_drvdata(dev); - return host1x->drm_data; + return host1x ? host1x->drm_data : NULL; } void host1x_sync_writel(struct host1x *host1x, u32 v, u32 r)