dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: David Airlie <airlied@linux.ie>, Hai Li <hali@codeaurora.org>,
	dri-devel@lists.freedesktop.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org, Rob Clark <robdclark@gmail.com>,
	Julia Lawall <julia.lawall@lip6.fr>
Subject: [PATCH 2/2] drm/msm/dsi: One function call less in dsi_init() after error detection
Date: Sat, 27 Jun 2015 23:23:10 +0200	[thread overview]
Message-ID: <558F143E.60300@users.sourceforge.net> (raw)
In-Reply-To: <558F12BA.60709@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 27 Jun 2015 22:23:28 +0200

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: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/gpu/drm/msm/dsi/dsi.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index dc4f38f..971f000 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -74,19 +74,15 @@ static void dsi_destroy(struct msm_dsi *msm_dsi)
 
 static struct msm_dsi *dsi_init(struct platform_device *pdev)
 {
-	struct msm_dsi *msm_dsi = NULL;
+	struct msm_dsi *msm_dsi;
 	int ret;
 
-	if (!pdev) {
-		ret = -ENXIO;
-		goto fail;
-	}
+	if (!pdev)
+		return -ENXIO;
 
 	msm_dsi = devm_kzalloc(&pdev->dev, sizeof(*msm_dsi), GFP_KERNEL);
-	if (!msm_dsi) {
-		ret = -ENOMEM;
-		goto fail;
-	}
+	if (!msm_dsi)
+		return -ENOMEM;
 	DBG("dsi probed=%p", msm_dsi);
 
 	msm_dsi->pdev = pdev;
@@ -95,21 +91,21 @@ static struct msm_dsi *dsi_init(struct platform_device *pdev)
 	/* Init dsi host */
 	ret = msm_dsi_host_init(msm_dsi);
 	if (ret)
-		goto fail;
+		goto destroy_dsi;
 
 	/* GET dsi PHY */
 	ret = dsi_get_phy(msm_dsi);
 	if (ret)
-		goto fail;
+		goto destroy_dsi;
 
 	/* Register to dsi manager */
 	ret = msm_dsi_manager_register(msm_dsi);
 	if (ret)
-		goto fail;
+		goto destroy_dsi;
 
 	return msm_dsi;
 
-fail:
+destroy_dsi:
 	dsi_destroy(msm_dsi);
 	return ERR_PTR(ret);
 }
-- 
2.4.4


  parent reply	other threads:[~2015-06-27 21:23 UTC|newest]

Thread overview: 123+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5307CAA2.8060406@users.sourceforge.net>
     [not found] ` <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6>
     [not found]   ` <530A086E.8010901@users.sourceforge.net>
     [not found]     ` <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6>
     [not found]       ` <530A72AA.3000601@users.sourceforge.net>
     [not found]         ` <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6>
     [not found]           ` <530B5FB6.6010207@users.sourceforge.net>
     [not found]             ` <alpine.DEB.2.10.1402241710370.2074@hadrien>
     [not found]               ` <530C5E18.1020800@users.sourceforge.net>
     [not found]                 ` <alpine.DEB.2.10.1402251014170.2080@hadrien>
     [not found]                   ` <530CD2C4.4050903@users.sourceforge.net>
     [not found]                     ` <alpine.DEB.2.10.1402251840450.7035@hadrien>
     [not found]                       ` <530CF8FF.8080600@users.sourceforge.net>
     [not found]                         ` <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6>
     [not found]                           ` <530DD06F.4090703@users.sourceforge.net>
     [not found]                             ` <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6>
     [not found]                               ` <5317A59D.4@users.so urceforge.net>
     [not found]                                 ` <5317A59D.4@users.sourceforge.net>
2014-10-22 14:30                                   ` [PATCH 1/1] GPU-DRM-nouveau: Deletion of unnecessary checks before two function calls SF Markus Elfring
2015-07-05 18:22                                     ` [PATCH] GPU-DRM-nouveau: Delete " SF Markus Elfring
2016-07-20 17:50                                       ` [PATCH] GPU-DRM-nouveau: Delete an unnecessary check before the function call "pci_dev_put" SF Markus Elfring
2014-10-22 16:48                                   ` [PATCH 1/1] GPU-DRM-GMA500: Deletion of unnecessary checks before two function calls SF Markus Elfring
2014-10-23 11:26                                     ` One Thousand Gnomes
2014-10-26 12:10                                       ` SF Markus Elfring
2014-10-26 14:56                                         ` Arthur Borsboom
2016-07-22  8:45                                     ` [PATCH] GPU-DRM-GMA500: Delete " SF Markus Elfring
2016-07-22  9:32                                       ` Daniel Vetter
2014-11-19 15:40                                   ` [PATCH 1/1] DRM-EDID: Deletion of an unnecessary check before the function call "release_firmware" SF Markus Elfring
2014-11-20  4:03                                     ` Thierry Reding
2014-11-19 16:14                                   ` [PATCH 1/1] DRM-tilcdc: Deletion of an unnecessary check before the function call "drm_fbdev_cma_hotplug_event" SF Markus Elfring
2014-11-20  4:11                                     ` Thierry Reding
2014-11-19 16:37                                   ` [PATCH 1/1] DRM-UDL: Deletion of an unnecessary check before the function call "vunmap" SF Markus Elfring
2014-11-20  4:17                                     ` Thierry Reding
2014-11-19 16:55                                   ` [PATCH 1/1] DRM-vmwgfx: Deletion of an unnecessary check before the function call "vfree" SF Markus Elfring
2014-11-20  4:22                                     ` Thierry Reding
2015-07-06  8:01                                     ` SF Markus Elfring
2015-07-08  5:49                                       ` John Hunter
2015-07-08 16:55                                         ` SF Markus Elfring
2015-07-09  0:08                                           ` John Hunter
2016-07-22 11:45                                       ` [PATCH] drm/vmwgfx: Delete " SF Markus Elfring
2016-07-22 15:25                                         ` Sean Paul
2016-07-22 15:33                                         ` Sinclair Yeh
2014-11-25 12:50                                   ` [PATCH 1/1] GPU-DRM-MSM-Adreno: Deletion of unnecessary checks before the function call "release_firmware" SF Markus Elfring
2014-12-01 16:01                                     ` Thierry Reding
2014-11-25 13:33                                   ` [PATCH 1/1] GPU-DRM-MSM: Deletion of unnecessary checks before two function calls SF Markus Elfring
2014-12-01 16:04                                     ` Thierry Reding
2014-12-01 16:09                                       ` Rob Clark
2014-12-01 16:14                                     ` Rob Clark
2015-02-04 21:00                                   ` [PATCH] GPU-DRM-Exynos: Delete " SF Markus Elfring
2015-02-05  8:29                                     ` Joonyoung Shim
2015-06-27 17:17                                       ` SF Markus Elfring
2016-07-21 17:42                                       ` [PATCH] GPU-DRM-Exynos: Delete an unnecessary check before the function call "vunmap" SF Markus Elfring
2016-07-21 18:07                                         ` Sean Paul
2015-02-04 21:25                                   ` [PATCH] GPU-DRM-OMAP: Delete unnecessary checks before two function calls SF Markus Elfring
2016-07-22  6:45                                     ` SF Markus Elfring
2015-02-05  9:20                                   ` [PATCH] GPU-DRM-Tegra: Delete an unnecessary check before the function call "vunmap" SF Markus Elfring
2015-07-08 18:40                                     ` SF Markus Elfring
2015-07-13 14:16                                       ` Alexandre Courbot
2016-07-16  5:30                                         ` [PATCH] drm/tegra: " SF Markus Elfring
2015-06-27 18:51                                   ` [PATCH] drm/bridge: ps8622: Delete a check before backlight_device_unregister() SF Markus Elfring
2016-07-22 12:54                                     ` [PATCH] drm/bridge: ps8622: Delete an unnecessary " SF Markus Elfring
2016-07-22 15:25                                       ` Sean Paul
2015-06-27 21:16                                   ` [PATCH 0/2] drm/msm/dsi: Deletion of an unnecessary check SF Markus Elfring
2015-06-27 21:20                                     ` [PATCH 1/2] drm/msm/dsi: Delete an unnecessary check before the function call "dsi_destroy" SF Markus Elfring
2015-06-27 21:23                                     ` SF Markus Elfring [this message]
2015-06-28  8:45                                   ` [PATCH] drm/amdgpu: Delete an unnecessary check before the function call "kfree" SF Markus Elfring
2015-06-29 15:30                                     ` Alex Deucher
2016-07-16 14:33                                     ` [PATCH 0/8] drm/amdgpu: Fine-tuning for three function implementations SF Markus Elfring
2016-07-16 14:45                                       ` [PATCH 1/8] drm/amdgpu: Delete an unnecessary check before drm_gem_object_unreference_unlocked() SF Markus Elfring
2016-07-16 14:48                                       ` [PATCH 2/8] drm/amdgpu/powerplay: Delete unnecessary checks before the function call "kfree" SF Markus Elfring
2016-07-16 14:50                                       ` [PATCH 3/8] drm/amdgpu: One function call less in amdgpu_cgs_acpi_eval_object() after error detection SF Markus Elfring
2016-07-16 14:54                                       ` [PATCH 4/8] drm/amdgpu: Delete a variable in amdgpu_cgs_acpi_eval_object() SF Markus Elfring
2016-07-16 14:56                                         ` [PATCH 5/8] drm/amdgpu: Delete an unnecessary variable initialisation " SF Markus Elfring
2016-07-16 15:00                                       ` SF Markus Elfring
2016-07-16 15:05                                       ` [PATCH 6/8] drm/amdgpu: Change assignment for a variable " SF Markus Elfring
2016-07-16 15:08                                       ` [PATCH 7/8] drm/amd/powerplay: Change assignment for a buffer variable in phm_dispatch_table() SF Markus Elfring
2016-07-17 15:03                                         ` walter harms
2016-07-16 15:10                                       ` [PATCH 8/8] drm/amd/powerplay: Delete an unnecessary variable initialisation " SF Markus Elfring
2016-07-18  7:41                                       ` [PATCH 0/8] drm/amdgpu: Fine-tuning for three function implementations Christian König
2016-07-28 16:10                                         ` Alex Deucher
2015-07-05 20:00                                   ` [PATCH] GPU-DRM: Delete an unnecessary check before drm_property_unreference_blob() SF Markus Elfring
2015-07-06  2:01                                     ` John Hunter
2015-07-06  6:53                                       ` Daniel Vetter
2015-11-06 11:13                                         ` [PATCH] GPU-DRM: Delete unnecessary checks " SF Markus Elfring
2015-11-16 14:04                                           ` Daniel Vetter
2016-07-20 16:02                                             ` [PATCH] drm/atomic: Delete an unnecessary check " SF Markus Elfring
2016-07-20 17:29                                               ` Sean Paul
2015-07-05 20:50                                   ` [PATCH] GPU-DRM-IMX: Delete an unnecessary check before drm_fbdev_cma_restore_mode() SF Markus Elfring
2015-11-20 12:53                                     ` Philipp Zabel
2015-11-06 12:43                                   ` [PATCH] GPU-DRM-i915: Delete an unnecessary check before the function call "pwm_put" SF Markus Elfring
2015-11-06 12:52                                     ` Jani Nikula
2015-11-06 12:55                                       ` SF Markus Elfring
2015-11-06 13:17                                         ` Jani Nikula
2015-11-06 13:45                                   ` [PATCH] GPU-DRM-ps8622: Delete an unnecessary check before backlight_device_unregister() SF Markus Elfring
2015-11-06 14:05                                   ` [PATCH] HDMI-HDCP: Delete an unnecessary check before the function call "kfree" SF Markus Elfring
2015-11-06 15:08                                   ` [PATCH] GPU-DRM-vc4: Delete unnecessary checks before two function calls SF Markus Elfring
2016-07-15 19:21                                     ` [PATCH] drm/vc4: " SF Markus Elfring
2015-11-16 14:45                                   ` [PATCH] GPU-DRM-TTM: Delete an unnecessary check before the function call "ttm_tt_destroy" SF Markus Elfring
2016-07-15 18:28                                     ` [PATCH] drm/ttm: " SF Markus Elfring
2016-07-18  7:12                                       ` Daniel Vetter
2016-07-18 14:10                                         ` [PATCH v3] " SF Markus Elfring
2016-07-18 14:45                                           ` Daniel Vetter
2016-07-18 17:00                                             ` SF Markus Elfring
2016-07-19  8:14                                             ` [PATCH v3] " Geert Uytterhoeven
2016-07-19  8:21                                               ` Daniel Vetter
2016-07-12 20:22                                   ` [PATCH] GPU-DRM-Radeon: Delete an unnecessary check before drm_gem_object_unreference_unlocked() SF Markus Elfring
2016-07-28 15:58                                     ` Alex Deucher
2016-07-13 17:54                                   ` [PATCH 0/3] drm/msm: Deletion of a few unnecessary checks SF Markus Elfring
2016-07-13 18:00                                     ` [PATCH 1/3] drm/msm/hdmi: Delete an unnecessary check before the function call "kfree" SF Markus Elfring
2016-07-13 18:01                                     ` [PATCH 2/3] drm/msm: Delete unnecessary checks before drm_gem_object_unreference_unlocked() SF Markus Elfring
2016-07-13 18:02                                     ` [PATCH 3/3] drm/msm: Delete an unnecessary check before drm_gem_object_unreference() SF Markus Elfring
2016-07-15  2:08                                     ` [PATCH 0/3] drm/msm: Deletion of a few unnecessary checks Rob Clark
2016-07-15 12:30                                   ` [PATCH] drm/bochs: Delete an unnecessary check before drm_gem_object_unreference_unlocked() SF Markus Elfring
2016-07-15 13:35                                   ` [PATCH] drm/rockchip: " SF Markus Elfring
2016-07-19  1:59                                     ` Mark yao
2016-07-15 20:00                                   ` [PATCH] drm/arcpgu: Delete an unnecessary check before drm_fbdev_cma_hotplug_event() SF Markus Elfring
2016-07-19 18:04                                     ` Alexey Brodkin
2016-07-15 20:44                                   ` [PATCH] drm/virtgpu: Delete unnecessary checks before drm_gem_object_unreference_unlocked() SF Markus Elfring
2016-07-16  6:40                                   ` [PATCH] drm/cirrus: Delete an unnecessary check " SF Markus Elfring
2016-07-16  7:20                                   ` [PATCH] drm/hdlcd: Delete an unnecessary check before drm_fbdev_cma_hotplug_event() SF Markus Elfring
2016-07-18  9:21                                     ` Liviu Dudau
2016-07-16  8:04                                   ` [PATCH] drm/ast: Delete an unnecessary check before drm_gem_object_unreference_unlocked() SF Markus Elfring
2016-07-18  6:53                                     ` Daniel Vetter
2016-07-20 16:40                                   ` [PATCH] GPU-DRM-sun4i: Delete an unnecessary check before drm_fbdev_cma_hotplug_event() SF Markus Elfring
2016-07-20 17:47                                     ` Daniel Vetter
2016-07-22  9:32                                   ` [PATCH] drm/mgag200: Delete an unnecessary check before drm_gem_object_unreference_unlocked() SF Markus Elfring
2016-07-22 15:25                                     ` Sean Paul
2016-07-22 10:56                                   ` [PATCH] GPU-DRM: Delete an unnecessary check before drm_property_unreference_blob() SF Markus Elfring
2016-07-25  8:43                                     ` Matthias Brugger
2016-07-22 12:22                                   ` [PATCH] drm/qxl: Delete an unnecessary check before drm_gem_object_unreference_unlocked() SF Markus Elfring
2016-07-22 15:25                                     ` Sean Paul
2016-07-22 15:42                                   ` [PATCH 0/4] GPU-DRM-Etnaviv: Fine-tuning for a few functions SF Markus Elfring
2016-07-22 15:47                                     ` [PATCH 1/4] GPU-DRM-Etnaviv: Delete unnecessary checks before two function calls SF Markus Elfring
2016-07-22 17:53                                       ` Sean Paul
2016-07-22 15:48                                     ` [PATCH 2/4] GPU-DRM-Etnaviv: Delete unnecessary if statement in __etnaviv_gem_new() SF Markus Elfring
2016-07-22 16:41                                       ` walter harms
2016-07-22 17:44                                         ` [PATCH] drm/etnaviv: Improve readability in __etnaviv_gem_new Sean Paul
2016-07-22 15:50                                     ` [PATCH 3/4] GPU-DRM-Etnaviv: Rename jump labels SF Markus Elfring
2016-07-22 17:45                                       ` Sean Paul
2016-07-22 15:51                                     ` [PATCH 4/4] GPU-DRM-Etnaviv: Optimize error handling in etnaviv_gem_new_userptr() SF Markus Elfring
2016-07-22 17:54                                       ` Sean Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=558F143E.60300@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hali@codeaurora.org \
    --cc=julia.lawall@lip6.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robdclark@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox