[next] drm/amd/display: fix the return of the uninitialized value in ret
diff mbox series

Message ID 20210302140509.8466-1-colin.king@canonical.com
State Accepted
Commit b934dd9b44e8ad180b3203ce7d6df3133453ee91
Headers show
Series
  • [next] drm/amd/display: fix the return of the uninitialized value in ret
Related show

Commit Message

Colin King March 2, 2021, 2:05 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Currently if stream->signal is neither SIGNAL_TYPE_DISPLAY_PORT_MST or
SIGNAL_TYPE_DISPLAY_PORT then variable ret is uninitialized and this is
checked for > 0 at the end of the function.  Ret should be initialized,
I believe setting it to zero is a correct default.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: bd0c064c161c ("drm/amd/display: Add return code instead of boolean for future use")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Harry Wentland March 2, 2021, 3:03 p.m. UTC | #1
On 2021-03-02 9:05 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently if stream->signal is neither SIGNAL_TYPE_DISPLAY_PORT_MST or
> SIGNAL_TYPE_DISPLAY_PORT then variable ret is uninitialized and this is
> checked for > 0 at the end of the function.  Ret should be initialized,
> I believe setting it to zero is a correct default.
> 
> Addresses-Coverity: ("Uninitialized scalar variable")
> Fixes: bd0c064c161c ("drm/amd/display: Add return code instead of boolean for future use")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

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

Harry

> ---
>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> index 5159399f8239..5750818db8f6 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> @@ -530,7 +530,7 @@ bool dm_helpers_dp_write_dsc_enable(
>   {
>   	uint8_t enable_dsc = enable ? 1 : 0;
>   	struct amdgpu_dm_connector *aconnector;
> -	uint8_t ret;
> +	uint8_t ret = 0;
>   
>   	if (!stream)
>   		return false;
>
Alex Deucher March 2, 2021, 5:51 p.m. UTC | #2
Applied.  Thanks!

Alex

On Tue, Mar 2, 2021 at 10:03 AM Harry Wentland <harry.wentland@amd.com> wrote:
>
> On 2021-03-02 9:05 a.m., Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > Currently if stream->signal is neither SIGNAL_TYPE_DISPLAY_PORT_MST or
> > SIGNAL_TYPE_DISPLAY_PORT then variable ret is uninitialized and this is
> > checked for > 0 at the end of the function.  Ret should be initialized,
> > I believe setting it to zero is a correct default.
> >
> > Addresses-Coverity: ("Uninitialized scalar variable")
> > Fixes: bd0c064c161c ("drm/amd/display: Add return code instead of boolean for future use")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
>
> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
>
> Harry
>
> > ---
> >   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> > index 5159399f8239..5750818db8f6 100644
> > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> > @@ -530,7 +530,7 @@ bool dm_helpers_dp_write_dsc_enable(
> >   {
> >       uint8_t enable_dsc = enable ? 1 : 0;
> >       struct amdgpu_dm_connector *aconnector;
> > -     uint8_t ret;
> > +     uint8_t ret = 0;
> >
> >       if (!stream)
> >               return false;
> >
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch
diff mbox series

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
index 5159399f8239..5750818db8f6 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
@@ -530,7 +530,7 @@  bool dm_helpers_dp_write_dsc_enable(
 {
 	uint8_t enable_dsc = enable ? 1 : 0;
 	struct amdgpu_dm_connector *aconnector;
-	uint8_t ret;
+	uint8_t ret = 0;
 
 	if (!stream)
 		return false;