kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/kmb: Fix possible oops in probe error handling
@ 2020-11-17  7:21 Dan Carpenter
  2020-11-20  1:29 ` Chrisanthus, Anitha
  2020-11-20  8:11 ` [PATCH v2] " Dan Carpenter
  0 siblings, 2 replies; 7+ messages in thread
From: Dan Carpenter @ 2020-11-17  7:21 UTC (permalink / raw)
  To: Anitha Chrisanthus
  Cc: David Airlie, Edmund Dea, kernel-janitors, dri-devel, Sam Ravnborg

If kmb_dsi_init() fails the error handling will dereference an error
pointer which will cause an Oops.

Fixes: 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/gpu/drm/kmb/kmb_drv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c
index a31a840ce634..8c43b136765c 100644
--- a/drivers/gpu/drm/kmb/kmb_drv.c
+++ b/drivers/gpu/drm/kmb/kmb_drv.c
@@ -504,7 +504,7 @@ static int kmb_probe(struct platform_device *pdev)
 	if (IS_ERR(kmb->kmb_dsi)) {
 		drm_err(&kmb->drm, "failed to initialize DSI\n");
 		ret = PTR_ERR(kmb->kmb_dsi);
-		goto err_free1;
+		goto err_clear_drvdata;
 	}
 
 	kmb->kmb_dsi->dev = &dsi_pdev->dev;
@@ -540,8 +540,9 @@ static int kmb_probe(struct platform_device *pdev)
 	drm_crtc_cleanup(&kmb->crtc);
 	drm_mode_config_cleanup(&kmb->drm);
  err_free1:
-	dev_set_drvdata(dev, NULL);
 	kmb_dsi_host_unregister(kmb->kmb_dsi);
+ err_clear_drvdata:
+	dev_set_drvdata(dev, NULL);
 
 	return ret;
 }
-- 
2.28.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-12-03  1:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17  7:21 [PATCH] drm/kmb: Fix possible oops in probe error handling Dan Carpenter
2020-11-20  1:29 ` Chrisanthus, Anitha
2020-11-20  8:09   ` Dan Carpenter
2020-11-20  8:11 ` [PATCH v2] " Dan Carpenter
2020-11-20 22:15   ` Chrisanthus, Anitha
2020-11-30  7:48     ` Dan Carpenter
2020-12-03  1:11       ` Chrisanthus, Anitha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).