[PATCH v5 2/4] drm/vc4: Check for V3D before binner bo alloc

From: Paul Kocialkowski
Date: Mon Apr 15 2019 - 08:39:23 EST


Check that we have a V3D device registered before attempting to
allocate a binner buffer object.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@xxxxxxxxxxx>
---
drivers/gpu/drm/vc4/vc4_v3d.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
index 9c73fad77449..a77c8d6c7d5b 100644
--- a/drivers/gpu/drm/vc4/vc4_v3d.c
+++ b/drivers/gpu/drm/vc4/vc4_v3d.c
@@ -241,6 +241,9 @@ int vc4_v3d_bin_bo_alloc(struct vc4_dev *vc4)
int ret = 0;
struct list_head list;

+ if (!v3d)
+ return -ENODEV;
+
/* We may need to try allocating more than once to get a BO
* that doesn't cross 256MB. Track the ones we've allocated
* that failed so far, so that we can free them when we've got
--
2.21.0