lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Wed,  4 Aug 2021 01:49:44 +0200
From:   "Sergio Miguéns Iglesias" <lonyelon@...il.com>
To:     airlied@...ux.ie
Cc:     nirmoy.das@....com, amd-gfx@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org,
        Sergio Miguéns Iglesias <sergio@...y.xyz>
Subject: [PATCH] DRM: amd: amdgpu: Fixed code style and removed unnecessary if statement

The file didn't follow the code style so it was changed. The "if" statement
checked if the framebuffer was initialized was also changed since that
condition is unlikely to happen. An unnecessary "if" was removed too since it
didn't execute any code if the condition was met.

Signed-off-by: Sergio Miguéns Iglesias <sergio@...y.xyz>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index 09b048647523..d2ab07eb00fb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -42,15 +42,16 @@
 #include "amdgpu_display.h"
 
 /* object hierarchy -
-   this contains a helper + a amdgpu fb
-   the helper contains a pointer to amdgpu framebuffer baseclass.
-*/
+ * this contains a helper + a amdgpu fb
+ * the helper contains a pointer to amdgpu framebuffer baseclass.
+ */
 
 static int
 amdgpufb_open(struct fb_info *info, int user)
 {
 	struct drm_fb_helper *fb_helper = info->par;
 	int ret = pm_runtime_get_sync(fb_helper->dev->dev);
+
 	if (ret < 0 && ret != -EACCES) {
 		pm_runtime_mark_last_busy(fb_helper->dev->dev);
 		pm_runtime_put_autosuspend(fb_helper->dev->dev);
@@ -182,9 +183,8 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
 
 	ret = amdgpu_bo_kmap(abo, NULL);
 	amdgpu_bo_unreserve(abo);
-	if (ret) {
+	if (ret)
 		goto out_unref;
-	}
 
 	*gobj_p = gobj;
 	return 0;
@@ -233,7 +233,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 
 	ret = amdgpu_display_gem_fb_init(adev_to_drm(adev), &rfbdev->rfb,
 					 &mode_cmd, gobj);
-	if (ret) {
+	if (unlikely(ret)) {
 		DRM_ERROR("failed to initialize framebuffer %d\n", ret);
 		goto out;
 	}
@@ -258,7 +258,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 
 	/* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */
 
-	if (info->screen_base == NULL) {
+	if (unlikely(info->screen_base == NULL)) {
 		ret = -ENOSPC;
 		goto out;
 	}
@@ -273,9 +273,6 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 	return 0;
 
 out:
-	if (abo) {
-
-	}
 	if (fb && ret) {
 		drm_gem_object_put(gobj);
 		drm_framebuffer_unregister_private(fb);
-- 
2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ