mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] drm/amd/display: Remove redundant assignment to variable dc
@ 2022-12-16 10:23 Yi Yang
  2023-01-05 19:19 ` Harry Wentland
  0 siblings, 1 reply; 3+ messages in thread
From: Yi Yang @ 2022-12-16 10:23 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, yiyang13
  Cc: amd-gfx, dri-devel, linux-kernel

Smatch report warning as follows:

Line 53679: drivers/gpu/drm/amd/display/dc/core/dc_stream.c:402
dc_stream_set_cursor_position() warn: variable dereferenced before
check 'stream'

The value of 'dc' has been assigned after check whether 'stream' is
NULL. Fix it by remove redundant assignment.

Signed-off-by: Yi Yang <yiyang13@huawei.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
index 20e534f73513..78d31bb875d1 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -408,7 +408,7 @@ bool dc_stream_set_cursor_position(
 	struct dc_stream_state *stream,
 	const struct dc_cursor_position *position)
 {
-	struct dc  *dc = stream->ctx->dc;
+	struct dc *dc;
 	bool reset_idle_optimizations = false;
 
 	if (NULL == stream) {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] drm/amd/display: Remove redundant assignment to variable dc
  2022-12-16 10:23 [PATCH -next] drm/amd/display: Remove redundant assignment to variable dc Yi Yang
@ 2023-01-05 19:19 ` Harry Wentland
  2023-01-06 15:28   ` Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: Harry Wentland @ 2023-01-05 19:19 UTC (permalink / raw)
  To: Yi Yang, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel
  Cc: amd-gfx, dri-devel, linux-kernel

On 12/16/22 05:23, Yi Yang wrote:
> Smatch report warning as follows:
> 
> Line 53679: drivers/gpu/drm/amd/display/dc/core/dc_stream.c:402
> dc_stream_set_cursor_position() warn: variable dereferenced before
> check 'stream'
> 
> The value of 'dc' has been assigned after check whether 'stream' is
> NULL. Fix it by remove redundant assignment.
> 
> Signed-off-by: Yi Yang <yiyang13@huawei.com>

If this didn't blow up until now we might not even need
the NULL check below, but either way this is correct and

Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>  drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> index 20e534f73513..78d31bb875d1 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> @@ -408,7 +408,7 @@ bool dc_stream_set_cursor_position(
>  	struct dc_stream_state *stream,
>  	const struct dc_cursor_position *position)
>  {
> -	struct dc  *dc = stream->ctx->dc;
> +	struct dc *dc;
>  	bool reset_idle_optimizations = false;
>  
>  	if (NULL == stream) {


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] drm/amd/display: Remove redundant assignment to variable dc
  2023-01-05 19:19 ` Harry Wentland
@ 2023-01-06 15:28   ` Alex Deucher
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2023-01-06 15:28 UTC (permalink / raw)
  To: Harry Wentland
  Cc: Yi Yang, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, dri-devel,
	amd-gfx, linux-kernel

Applied.  Thanks!

Alex

On Thu, Jan 5, 2023 at 2:20 PM Harry Wentland <harry.wentland@amd.com> wrote:
>
> On 12/16/22 05:23, Yi Yang wrote:
> > Smatch report warning as follows:
> >
> > Line 53679: drivers/gpu/drm/amd/display/dc/core/dc_stream.c:402
> > dc_stream_set_cursor_position() warn: variable dereferenced before
> > check 'stream'
> >
> > The value of 'dc' has been assigned after check whether 'stream' is
> > NULL. Fix it by remove redundant assignment.
> >
> > Signed-off-by: Yi Yang <yiyang13@huawei.com>
>
> If this didn't blow up until now we might not even need
> the NULL check below, but either way this is correct and
>
> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
>
> Harry
>
> > ---
> >  drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> > index 20e534f73513..78d31bb875d1 100644
> > --- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> > +++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
> > @@ -408,7 +408,7 @@ bool dc_stream_set_cursor_position(
> >       struct dc_stream_state *stream,
> >       const struct dc_cursor_position *position)
> >  {
> > -     struct dc  *dc = stream->ctx->dc;
> > +     struct dc *dc;
> >       bool reset_idle_optimizations = false;
> >
> >       if (NULL == stream) {
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-06 15:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-16 10:23 [PATCH -next] drm/amd/display: Remove redundant assignment to variable dc Yi Yang
2023-01-05 19:19 ` Harry Wentland
2023-01-06 15:28   ` Alex Deucher

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®