From: "Ernst Sjöstrand" <ernstp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: "Ernst Sjöstrand" <ernstp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 3/3] amdgpu/dc: Fix missing null checks in amdgpu_dm.c
Date: Tue, 7 Nov 2017 00:54:42 +0100 [thread overview]
Message-ID: <20171106235442.20636-4-ernstp@gmail.com> (raw)
In-Reply-To: <20171106235442.20636-1-ernstp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
From smatch:
error: we previously assumed X could be null
Signed-off-by: Ernst Sjöstrand <ernstp@gmail.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 2301589e4cc3..d036178c2241 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -432,8 +432,10 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
if (adev->dm.dc)
DRM_INFO("Display Core initialized!\n");
- else
+ else {
DRM_INFO("Display Core failed to initialize!\n");
+ goto error;
+ }
INIT_WORK(&adev->dm.mst_hotplug_work, hotplug_notify_work_func);
@@ -2263,7 +2265,7 @@ decide_crtc_timing_for_drm_display_mode(struct drm_display_mode *drm_mode,
}
}
-static void create_fake_sink(struct amdgpu_dm_connector *aconnector)
+static int create_fake_sink(struct amdgpu_dm_connector *aconnector)
{
struct dc_sink *sink = NULL;
struct dc_sink_init_data sink_init_data = { 0 };
@@ -2272,14 +2274,18 @@ static void create_fake_sink(struct amdgpu_dm_connector *aconnector)
sink_init_data.sink_signal = aconnector->dc_link->connector_signal;
sink = dc_sink_create(&sink_init_data);
- if (!sink)
+ if (!sink) {
DRM_ERROR("Failed to create sink!\n");
+ return -1;
+ }
sink->sink_signal = SIGNAL_TYPE_VIRTUAL;
aconnector->fake_enable = true;
aconnector->dc_sink = sink;
aconnector->dc_link->local_sink = sink;
+
+ return 0;
}
static struct dc_stream_state *
@@ -2313,7 +2319,8 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
if (aconnector->mst_port)
goto stream_create_fail;
- create_fake_sink(aconnector);
+ if (create_fake_sink(aconnector))
+ goto stream_create_fail;
}
stream = dc_create_stream_for_sink(aconnector->dc_sink);
--
2.14.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-11-06 23:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-06 23:54 More smatch fixes Ernst Sjöstrand
[not found] ` <20171106235442.20636-1-ernstp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-06 23:54 ` [PATCH 1/3] amdgpu/dc: fix more indentation warnings Ernst Sjöstrand
2017-11-06 23:54 ` [PATCH 2/3] amdgpu/dc: Fix potential null dereference in amdgpu_dm.c Ernst Sjöstrand
[not found] ` <20171106235442.20636-3-ernstp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-07 14:15 ` Deucher, Alexander
2017-11-06 23:54 ` Ernst Sjöstrand [this message]
[not found] ` <20171106235442.20636-4-ernstp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-07 10:33 ` [PATCH 3/3] amdgpu/dc: Fix missing null checks " Christian König
2017-11-07 14:18 ` Deucher, Alexander
[not found] ` <BN6PR12MB16521997C895FAC6062A77FAF7510-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-11-07 19:52 ` Ernst Sjöstrand
[not found] ` <CAD=4a=XB89VfDF2Vjk-7diHjuNFT14f3+-Am79mnUMqa5-bPiw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-07 19:57 ` Alex Deucher
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=20171106235442.20636-4-ernstp@gmail.com \
--to=ernstp-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.