Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <treding@nvidia.com>

+1 -1
+1 -1
drivers/gpu/host1x/dev.c
··· 43 43 void *host1x_get_drm_data(struct device *dev) 44 44 { 45 45 struct host1x *host1x = dev_get_drvdata(dev); 46 - return host1x->drm_data; 46 + return host1x ? host1x->drm_data : NULL; 47 47 } 48 48 49 49 void host1x_sync_writel(struct host1x *host1x, u32 v, u32 r)