mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Defang Bo <bodefang@126.com>
To: airlied@linux.ie, daniel@ffwll.ch
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Defang Bo <bodefang@126.com>
Subject: [PATCH 2/2] drivers/gpu/drm/ast: Fix infinite loop if read fails
Date: Fri, 25 Dec 2020 16:13:34 +0800	[thread overview]
Message-ID: <1608884014-2327765-2-git-send-email-bodefang@126.com> (raw)
In-Reply-To: <1608884014-2327765-1-git-send-email-bodefang@126.com>

[Why] Similar to commit <298360af3> ast_init_dram_reg() configures a window in order to access BMC memory.
A BMC register can be configured to disallow this, and if so, causes
an infinite loop in the ast driver which renders the system unusable.
[How]
Fix this by erroring out if an error is detected.

Signed-off-by: Defang Bo <bodefang@126.com>
---
 drivers/gpu/drm/ast/ast_post.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
index ef19c70..86e4d23 100644
--- a/drivers/gpu/drm/ast/ast_post.c
+++ b/drivers/gpu/drm/ast/ast_post.c
@@ -302,13 +302,13 @@ static void ast_init_dram_reg(struct drm_device *dev)
 			ast_write32(ast, 0x12000, 0x1688A8A8);
 			do {
 				if (pci_channel_offline(dev->pdev))
-                                        return -EIO;
+					return -EIO;
 			} while (ast_read32(ast, 0x12000) != 0x01);
 
 			ast_write32(ast, 0x10000, 0xfc600309);
 			do {
 				if (pci_channel_offline(dev->pdev))
-                                        return -EIO;
+					return -EIO;
 			} while (ast_read32(ast, 0x10000) != 0x01);
 		}
 
-- 
2.7.4


  reply	other threads:[~2020-12-25 11:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-25  8:13 [PATCH 1/2] " Defang Bo
2020-12-25  8:13 ` Defang Bo [this message]
2020-12-25 16:47   ` [PATCH 2/2] " Randy Dunlap

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=1608884014-2327765-2-git-send-email-bodefang@126.com \
    --to=bodefang@126.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®