From: Danila Chernetsov <listdansp@mail.ru>
To: Alex Deucher <alexander.deucher@amd.com>
Cc: "Danila Chernetsov" <listdansp@mail.ru>,
"Christian König" <christian.koenig@amd.com>,
"David Airlie" <airlied@linux.ie>,
"Daniel Vetter" <daniel@ffwll.ch>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org
Subject: [PATCH v5.10 1/1] drm/amdgpu: add error handling for drm_fb_helper_initial_config
Date: Sun, 12 Mar 2023 13:50:53 +0000 [thread overview]
Message-ID: <20230312135053.7218-1-listdansp@mail.ru> (raw)
The type of return value of drm_fb_helper_initial_config is int,
which may return wrong result, so we add error handling for it
to reclaim memory resource, and return when an error occurs.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: d38ceaf99ed0 (drm/amdgpu: add core driver (v4))
Signed-off-by: Danila Chernetsov <listdansp@mail.ru>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index 43f29ee0e3b0..e445a2c9f569 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -348,8 +348,17 @@ int amdgpu_fbdev_init(struct amdgpu_device *adev)
if (!amdgpu_device_has_dc_support(adev))
drm_helper_disable_unused_functions(adev_to_drm(adev));
- drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel);
- return 0;
+ ret = drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel);
+ if (ret)
+ goto fini;
+
+ return 0;
+
+fini:
+ drm_fb_helper_fini(&rfbdev->helper);
+
+ kfree(rfbdev);
+ return ret;
}
void amdgpu_fbdev_fini(struct amdgpu_device *adev)
--
2.25.1
reply other threads:[~2023-03-12 13:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230312135053.7218-1-listdansp@mail.ru \
--to=listdansp@mail.ru \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.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®