Message ID | 20180730152658.157098-2-seanpaul@chromium.org (mailing list archive) |
---|---|
State | Not Applicable, archived |
Delegated to: | Andy Gross |
Headers | show |
Series | drm/msm: dsi: Properly handle disconnected secondary dsi block | expand |
On 2018-07-30 08:26, Sean Paul wrote: > Currently msm_dsi->id is initialized to 0 during kzalloc. If bind fails > for a secondary dsi device before its id can be properly set (such as > during dt parsing), the id will point to the primary dsi device, > causing > its reference to be removed from dsi_manager's global (msm_dsim_glb) > array. > > This patch initializes the id to -1 and checks for negative in the > manager cleanup. > > Cc: Doug Anderson <dianders@chromium.org> > Signed-off-by: Sean Paul <seanpaul@chromium.org> Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org> > --- > drivers/gpu/drm/msm/dsi/dsi.c | 1 + > drivers/gpu/drm/msm/dsi/dsi_manager.c | 4 +++- > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/msm/dsi/dsi.c > b/drivers/gpu/drm/msm/dsi/dsi.c > index ff8164cc6738..ee07d58c2d97 100644 > --- a/drivers/gpu/drm/msm/dsi/dsi.c > +++ b/drivers/gpu/drm/msm/dsi/dsi.c > @@ -83,6 +83,7 @@ static struct msm_dsi *dsi_init(struct > platform_device *pdev) > return ERR_PTR(-ENOMEM); > DBG("dsi probed=%p", msm_dsi); > > + msm_dsi->id = -1; > msm_dsi->pdev = pdev; > platform_set_drvdata(pdev, msm_dsi); > > diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c > b/drivers/gpu/drm/msm/dsi/dsi_manager.c > index 5224010d90e4..80aa6344185e 100644 > --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c > +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c > @@ -839,6 +839,8 @@ void msm_dsi_manager_unregister(struct msm_dsi > *msm_dsi) > > if (msm_dsi->host) > msm_dsi_host_unregister(msm_dsi->host); > - msm_dsim->dsi[msm_dsi->id] = NULL; > + > + if (msm_dsi->id >= 0) > + msm_dsim->dsi[msm_dsi->id] = NULL; > } -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index ff8164cc6738..ee07d58c2d97 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -83,6 +83,7 @@ static struct msm_dsi *dsi_init(struct platform_device *pdev) return ERR_PTR(-ENOMEM); DBG("dsi probed=%p", msm_dsi); + msm_dsi->id = -1; msm_dsi->pdev = pdev; platform_set_drvdata(pdev, msm_dsi); diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 5224010d90e4..80aa6344185e 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -839,6 +839,8 @@ void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi) if (msm_dsi->host) msm_dsi_host_unregister(msm_dsi->host); - msm_dsim->dsi[msm_dsi->id] = NULL; + + if (msm_dsi->id >= 0) + msm_dsim->dsi[msm_dsi->id] = NULL; }
Currently msm_dsi->id is initialized to 0 during kzalloc. If bind fails for a secondary dsi device before its id can be properly set (such as during dt parsing), the id will point to the primary dsi device, causing its reference to be removed from dsi_manager's global (msm_dsim_glb) array. This patch initializes the id to -1 and checks for negative in the manager cleanup. Cc: Doug Anderson <dianders@chromium.org> Signed-off-by: Sean Paul <seanpaul@chromium.org> --- drivers/gpu/drm/msm/dsi/dsi.c | 1 + drivers/gpu/drm/msm/dsi/dsi_manager.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)