[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191216144348.7540-1-stefan@olimex.com>
Date: Mon, 16 Dec 2019 16:43:48 +0200
From: Stefan Mavrodiev <stefan@...mex.com>
To: Maxime Ripard <mripard@...nel.org>, Chen-Yu Tsai <wens@...e.org>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
dri-devel@...ts.freedesktop.org (open list:DRM DRIVERS FOR ALLWINNER
A10),
linux-arm-kernel@...ts.infradead.org (moderated list:ARM/Allwinner
sunXi SoC support), linux-kernel@...r.kernel.org (open list)
Cc: linux-sunxi@...glegroups.com, Stefan Mavrodiev <stefan@...mex.com>
Subject: [PATCH 1/1] drm/sun4i: hdmi: Check for null pointer before cleanup
It's possible hdmi->connector and hdmi->encoder divices to be NULL.
This can happen when building as kernel module and you try to remove
the module.
This patch make simple null check, before calling the cleanup functions.
Signed-off-by: Stefan Mavrodiev <stefan@...mex.com>
---
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
index a7c4654445c7..b61e00f2ecb8 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
@@ -685,8 +685,10 @@ static void sun4i_hdmi_unbind(struct device *dev, struct device *master,
struct sun4i_hdmi *hdmi = dev_get_drvdata(dev);
cec_unregister_adapter(hdmi->cec_adap);
- drm_connector_cleanup(&hdmi->connector);
- drm_encoder_cleanup(&hdmi->encoder);
+ if (hdmi->connector.dev)
+ drm_connector_cleanup(&hdmi->connector);
+ if (hdmi->encoder.dev)
+ drm_encoder_cleanup(&hdmi->encoder);
i2c_del_adapter(hdmi->i2c);
i2c_put_adapter(hdmi->ddc_i2c);
clk_disable_unprepare(hdmi->mod_clk);
--
2.17.1
Powered by blists - more mailing lists