Commit da882cd1 authored by Markus Elfring's avatar Markus Elfring Committed by Rob Clark

drm/msm/dsi: One function call less in dsi_init() after error detection

The dsi_destroy() function was called in two cases by the dsi_init() function
during error handling even if the passed variable contained a null pointer.

* This implementation detail could be improved by adjustments for jump
  targets according to the Linux coding style convention.

* Drop an unnecessary initialisation for the variable "msm_dsi" then.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
[add couple missing ERR_PTR()'s]
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent a60bbb27
...@@ -74,19 +74,15 @@ static void dsi_destroy(struct msm_dsi *msm_dsi) ...@@ -74,19 +74,15 @@ static void dsi_destroy(struct msm_dsi *msm_dsi)
static struct msm_dsi *dsi_init(struct platform_device *pdev) static struct msm_dsi *dsi_init(struct platform_device *pdev)
{ {
struct msm_dsi *msm_dsi = NULL; struct msm_dsi *msm_dsi;
int ret; int ret;
if (!pdev) { if (!pdev)
ret = -ENXIO; return ERR_PTR(-ENXIO);
goto fail;
}
msm_dsi = devm_kzalloc(&pdev->dev, sizeof(*msm_dsi), GFP_KERNEL); msm_dsi = devm_kzalloc(&pdev->dev, sizeof(*msm_dsi), GFP_KERNEL);
if (!msm_dsi) { if (!msm_dsi)
ret = -ENOMEM; return ERR_PTR(-ENOMEM);
goto fail;
}
DBG("dsi probed=%p", msm_dsi); DBG("dsi probed=%p", msm_dsi);
msm_dsi->pdev = pdev; msm_dsi->pdev = pdev;
...@@ -95,21 +91,21 @@ static struct msm_dsi *dsi_init(struct platform_device *pdev) ...@@ -95,21 +91,21 @@ static struct msm_dsi *dsi_init(struct platform_device *pdev)
/* Init dsi host */ /* Init dsi host */
ret = msm_dsi_host_init(msm_dsi); ret = msm_dsi_host_init(msm_dsi);
if (ret) if (ret)
goto fail; goto destroy_dsi;
/* GET dsi PHY */ /* GET dsi PHY */
ret = dsi_get_phy(msm_dsi); ret = dsi_get_phy(msm_dsi);
if (ret) if (ret)
goto fail; goto destroy_dsi;
/* Register to dsi manager */ /* Register to dsi manager */
ret = msm_dsi_manager_register(msm_dsi); ret = msm_dsi_manager_register(msm_dsi);
if (ret) if (ret)
goto fail; goto destroy_dsi;
return msm_dsi; return msm_dsi;
fail: destroy_dsi:
dsi_destroy(msm_dsi); dsi_destroy(msm_dsi);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment