linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][drm-next] drm/amdgpu/powerplay: fix missing break in switch statements
@ 2018-10-08 16:22 Colin King
  2018-10-09 10:43 ` Huang Rui
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2018-10-08 16:22 UTC (permalink / raw)
  To: Rex Zhu, Evan Quan, Christian König, David Zhou,
	David Airlie, amd-gfx, dri-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

There are several switch statements that are missing break statements.
Add missing breaks to handle any fall-throughs corner cases.

Detected by CoverityScan, CID#1457175 ("Missing break in switch")

Fixes: 18aafc59b106 ("drm/amd/powerplay: implement fw related smu interface for iceland.")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c      | 2 ++
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c    | 2 ++
 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c | 2 ++
 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c   | 2 ++
 drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c   | 2 ++
 5 files changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
index 18643e06bc6f..669bd0c2a16c 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
@@ -2269,11 +2269,13 @@ static uint32_t ci_get_offsetof(uint32_t type, uint32_t member)
 		case DRAM_LOG_BUFF_SIZE:
 			return offsetof(SMU7_SoftRegisters, DRAM_LOG_BUFF_SIZE);
 		}
+		break;
 	case SMU_Discrete_DpmTable:
 		switch (member) {
 		case LowSclkInterruptThreshold:
 			return offsetof(SMU7_Discrete_DpmTable, LowSclkInterruptT);
 		}
+		break;
 	}
 	pr_debug("can't get the offset of type %x member %x\n", type, member);
 	return 0;
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
index ec14798e87b6..bddd6d09f887 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
@@ -2331,6 +2331,7 @@ static uint32_t fiji_get_offsetof(uint32_t type, uint32_t member)
 		case DRAM_LOG_BUFF_SIZE:
 			return offsetof(SMU73_SoftRegisters, DRAM_LOG_BUFF_SIZE);
 		}
+		break;
 	case SMU_Discrete_DpmTable:
 		switch (member) {
 		case UvdBootLevel:
@@ -2340,6 +2341,7 @@ static uint32_t fiji_get_offsetof(uint32_t type, uint32_t member)
 		case LowSclkInterruptThreshold:
 			return offsetof(SMU73_Discrete_DpmTable, LowSclkInterruptThreshold);
 		}
+		break;
 	}
 	pr_warn("can't get the offset of type %x member %x\n", type, member);
 	return 0;
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
index 73aa368a454e..2d4c7f167b88 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
@@ -2237,11 +2237,13 @@ static uint32_t iceland_get_offsetof(uint32_t type, uint32_t member)
 		case DRAM_LOG_BUFF_SIZE:
 			return offsetof(SMU71_SoftRegisters, DRAM_LOG_BUFF_SIZE);
 		}
+		break;
 	case SMU_Discrete_DpmTable:
 		switch (member) {
 		case LowSclkInterruptThreshold:
 			return offsetof(SMU71_Discrete_DpmTable, LowSclkInterruptThreshold);
 		}
+		break;
 	}
 	pr_warn("can't get the offset of type %x member %x\n", type, member);
 	return 0;
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
index ae8378ed32ee..a2ba5b012866 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
@@ -2619,6 +2619,7 @@ static uint32_t tonga_get_offsetof(uint32_t type, uint32_t member)
 		case DRAM_LOG_BUFF_SIZE:
 			return offsetof(SMU72_SoftRegisters, DRAM_LOG_BUFF_SIZE);
 		}
+		break;
 	case SMU_Discrete_DpmTable:
 		switch (member) {
 		case UvdBootLevel:
@@ -2628,6 +2629,7 @@ static uint32_t tonga_get_offsetof(uint32_t type, uint32_t member)
 		case LowSclkInterruptThreshold:
 			return offsetof(SMU72_Discrete_DpmTable, LowSclkInterruptThreshold);
 		}
+		break;
 	}
 	pr_warn("can't get the offset of type %x member %x\n", type, member);
 	return 0;
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
index 3d415fabbd93..9f71512b2510 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
@@ -2185,6 +2185,7 @@ static uint32_t vegam_get_offsetof(uint32_t type, uint32_t member)
 		case DRAM_LOG_BUFF_SIZE:
 			return offsetof(SMU75_SoftRegisters, DRAM_LOG_BUFF_SIZE);
 		}
+		break;
 	case SMU_Discrete_DpmTable:
 		switch (member) {
 		case UvdBootLevel:
@@ -2194,6 +2195,7 @@ static uint32_t vegam_get_offsetof(uint32_t type, uint32_t member)
 		case LowSclkInterruptThreshold:
 			return offsetof(SMU75_Discrete_DpmTable, LowSclkInterruptThreshold);
 		}
+		break;
 	}
 	pr_warn("can't get the offset of type %x member %x\n", type, member);
 	return 0;
-- 
2.17.1


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

* Re: [PATCH][drm-next] drm/amdgpu/powerplay: fix missing break in switch statements
  2018-10-08 16:22 [PATCH][drm-next] drm/amdgpu/powerplay: fix missing break in switch statements Colin King
@ 2018-10-09 10:43 ` Huang Rui
  2018-10-10 19:08   ` Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: Huang Rui @ 2018-10-09 10:43 UTC (permalink / raw)
  To: Colin King
  Cc: Rex Zhu, Evan Quan, Christian König, David Zhou,
	David Airlie, amd-gfx, dri-devel, kernel-janitors, linux-kernel

On Mon, Oct 08, 2018 at 05:22:28PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> There are several switch statements that are missing break statements.
> Add missing breaks to handle any fall-throughs corner cases.
> 
> Detected by CoverityScan, CID#1457175 ("Missing break in switch")
> 
> Fixes: 18aafc59b106 ("drm/amd/powerplay: implement fw related smu interface for iceland.")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Acked-by: Huang Rui <ray.huang@amd.com>

> ---
>  drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c      | 2 ++
>  drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c    | 2 ++
>  drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c | 2 ++
>  drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c   | 2 ++
>  drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c   | 2 ++
>  5 files changed, 10 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
> index 18643e06bc6f..669bd0c2a16c 100644
> --- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
> @@ -2269,11 +2269,13 @@ static uint32_t ci_get_offsetof(uint32_t type, uint32_t member)
>  		case DRAM_LOG_BUFF_SIZE:
>  			return offsetof(SMU7_SoftRegisters, DRAM_LOG_BUFF_SIZE);
>  		}
> +		break;
>  	case SMU_Discrete_DpmTable:
>  		switch (member) {
>  		case LowSclkInterruptThreshold:
>  			return offsetof(SMU7_Discrete_DpmTable, LowSclkInterruptT);
>  		}
> +		break;
>  	}
>  	pr_debug("can't get the offset of type %x member %x\n", type, member);
>  	return 0;
> diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
> index ec14798e87b6..bddd6d09f887 100644
> --- a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
> @@ -2331,6 +2331,7 @@ static uint32_t fiji_get_offsetof(uint32_t type, uint32_t member)
>  		case DRAM_LOG_BUFF_SIZE:
>  			return offsetof(SMU73_SoftRegisters, DRAM_LOG_BUFF_SIZE);
>  		}
> +		break;
>  	case SMU_Discrete_DpmTable:
>  		switch (member) {
>  		case UvdBootLevel:
> @@ -2340,6 +2341,7 @@ static uint32_t fiji_get_offsetof(uint32_t type, uint32_t member)
>  		case LowSclkInterruptThreshold:
>  			return offsetof(SMU73_Discrete_DpmTable, LowSclkInterruptThreshold);
>  		}
> +		break;
>  	}
>  	pr_warn("can't get the offset of type %x member %x\n", type, member);
>  	return 0;
> diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
> index 73aa368a454e..2d4c7f167b88 100644
> --- a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
> @@ -2237,11 +2237,13 @@ static uint32_t iceland_get_offsetof(uint32_t type, uint32_t member)
>  		case DRAM_LOG_BUFF_SIZE:
>  			return offsetof(SMU71_SoftRegisters, DRAM_LOG_BUFF_SIZE);
>  		}
> +		break;
>  	case SMU_Discrete_DpmTable:
>  		switch (member) {
>  		case LowSclkInterruptThreshold:
>  			return offsetof(SMU71_Discrete_DpmTable, LowSclkInterruptThreshold);
>  		}
> +		break;
>  	}
>  	pr_warn("can't get the offset of type %x member %x\n", type, member);
>  	return 0;
> diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
> index ae8378ed32ee..a2ba5b012866 100644
> --- a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
> @@ -2619,6 +2619,7 @@ static uint32_t tonga_get_offsetof(uint32_t type, uint32_t member)
>  		case DRAM_LOG_BUFF_SIZE:
>  			return offsetof(SMU72_SoftRegisters, DRAM_LOG_BUFF_SIZE);
>  		}
> +		break;
>  	case SMU_Discrete_DpmTable:
>  		switch (member) {
>  		case UvdBootLevel:
> @@ -2628,6 +2629,7 @@ static uint32_t tonga_get_offsetof(uint32_t type, uint32_t member)
>  		case LowSclkInterruptThreshold:
>  			return offsetof(SMU72_Discrete_DpmTable, LowSclkInterruptThreshold);
>  		}
> +		break;
>  	}
>  	pr_warn("can't get the offset of type %x member %x\n", type, member);
>  	return 0;
> diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> index 3d415fabbd93..9f71512b2510 100644
> --- a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> @@ -2185,6 +2185,7 @@ static uint32_t vegam_get_offsetof(uint32_t type, uint32_t member)
>  		case DRAM_LOG_BUFF_SIZE:
>  			return offsetof(SMU75_SoftRegisters, DRAM_LOG_BUFF_SIZE);
>  		}
> +		break;
>  	case SMU_Discrete_DpmTable:
>  		switch (member) {
>  		case UvdBootLevel:
> @@ -2194,6 +2195,7 @@ static uint32_t vegam_get_offsetof(uint32_t type, uint32_t member)
>  		case LowSclkInterruptThreshold:
>  			return offsetof(SMU75_Discrete_DpmTable, LowSclkInterruptThreshold);
>  		}
> +		break;
>  	}
>  	pr_warn("can't get the offset of type %x member %x\n", type, member);
>  	return 0;
> -- 
> 2.17.1
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH][drm-next] drm/amdgpu/powerplay: fix missing break in switch statements
  2018-10-09 10:43 ` Huang Rui
@ 2018-10-10 19:08   ` Alex Deucher
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2018-10-10 19:08 UTC (permalink / raw)
  To: Huang Rui
  Cc: Colin Ian King, Dave Airlie, kernel-janitors, LKML, amd-gfx list,
	Maling list - DRI developers, Quan, Evan, Rex Zhu,
	Christian Koenig

On Tue, Oct 9, 2018 at 6:44 AM Huang Rui <ray.huang@amd.com> wrote:
>
> On Mon, Oct 08, 2018 at 05:22:28PM +0100, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > There are several switch statements that are missing break statements.
> > Add missing breaks to handle any fall-throughs corner cases.
> >
> > Detected by CoverityScan, CID#1457175 ("Missing break in switch")
> >
> > Fixes: 18aafc59b106 ("drm/amd/powerplay: implement fw related smu interface for iceland.")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
>
> Acked-by: Huang Rui <ray.huang@amd.com>
>

Applied.  thanks!

Alex

> > ---
> >  drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c      | 2 ++
> >  drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c    | 2 ++
> >  drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c | 2 ++
> >  drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c   | 2 ++
> >  drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c   | 2 ++
> >  5 files changed, 10 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
> > index 18643e06bc6f..669bd0c2a16c 100644
> > --- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
> > +++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
> > @@ -2269,11 +2269,13 @@ static uint32_t ci_get_offsetof(uint32_t type, uint32_t member)
> >               case DRAM_LOG_BUFF_SIZE:
> >                       return offsetof(SMU7_SoftRegisters, DRAM_LOG_BUFF_SIZE);
> >               }
> > +             break;
> >       case SMU_Discrete_DpmTable:
> >               switch (member) {
> >               case LowSclkInterruptThreshold:
> >                       return offsetof(SMU7_Discrete_DpmTable, LowSclkInterruptT);
> >               }
> > +             break;
> >       }
> >       pr_debug("can't get the offset of type %x member %x\n", type, member);
> >       return 0;
> > diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
> > index ec14798e87b6..bddd6d09f887 100644
> > --- a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
> > +++ b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
> > @@ -2331,6 +2331,7 @@ static uint32_t fiji_get_offsetof(uint32_t type, uint32_t member)
> >               case DRAM_LOG_BUFF_SIZE:
> >                       return offsetof(SMU73_SoftRegisters, DRAM_LOG_BUFF_SIZE);
> >               }
> > +             break;
> >       case SMU_Discrete_DpmTable:
> >               switch (member) {
> >               case UvdBootLevel:
> > @@ -2340,6 +2341,7 @@ static uint32_t fiji_get_offsetof(uint32_t type, uint32_t member)
> >               case LowSclkInterruptThreshold:
> >                       return offsetof(SMU73_Discrete_DpmTable, LowSclkInterruptThreshold);
> >               }
> > +             break;
> >       }
> >       pr_warn("can't get the offset of type %x member %x\n", type, member);
> >       return 0;
> > diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
> > index 73aa368a454e..2d4c7f167b88 100644
> > --- a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
> > +++ b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
> > @@ -2237,11 +2237,13 @@ static uint32_t iceland_get_offsetof(uint32_t type, uint32_t member)
> >               case DRAM_LOG_BUFF_SIZE:
> >                       return offsetof(SMU71_SoftRegisters, DRAM_LOG_BUFF_SIZE);
> >               }
> > +             break;
> >       case SMU_Discrete_DpmTable:
> >               switch (member) {
> >               case LowSclkInterruptThreshold:
> >                       return offsetof(SMU71_Discrete_DpmTable, LowSclkInterruptThreshold);
> >               }
> > +             break;
> >       }
> >       pr_warn("can't get the offset of type %x member %x\n", type, member);
> >       return 0;
> > diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
> > index ae8378ed32ee..a2ba5b012866 100644
> > --- a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
> > +++ b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
> > @@ -2619,6 +2619,7 @@ static uint32_t tonga_get_offsetof(uint32_t type, uint32_t member)
> >               case DRAM_LOG_BUFF_SIZE:
> >                       return offsetof(SMU72_SoftRegisters, DRAM_LOG_BUFF_SIZE);
> >               }
> > +             break;
> >       case SMU_Discrete_DpmTable:
> >               switch (member) {
> >               case UvdBootLevel:
> > @@ -2628,6 +2629,7 @@ static uint32_t tonga_get_offsetof(uint32_t type, uint32_t member)
> >               case LowSclkInterruptThreshold:
> >                       return offsetof(SMU72_Discrete_DpmTable, LowSclkInterruptThreshold);
> >               }
> > +             break;
> >       }
> >       pr_warn("can't get the offset of type %x member %x\n", type, member);
> >       return 0;
> > diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> > index 3d415fabbd93..9f71512b2510 100644
> > --- a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> > +++ b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> > @@ -2185,6 +2185,7 @@ static uint32_t vegam_get_offsetof(uint32_t type, uint32_t member)
> >               case DRAM_LOG_BUFF_SIZE:
> >                       return offsetof(SMU75_SoftRegisters, DRAM_LOG_BUFF_SIZE);
> >               }
> > +             break;
> >       case SMU_Discrete_DpmTable:
> >               switch (member) {
> >               case UvdBootLevel:
> > @@ -2194,6 +2195,7 @@ static uint32_t vegam_get_offsetof(uint32_t type, uint32_t member)
> >               case LowSclkInterruptThreshold:
> >                       return offsetof(SMU75_Discrete_DpmTable, LowSclkInterruptThreshold);
> >               }
> > +             break;
> >       }
> >       pr_warn("can't get the offset of type %x member %x\n", type, member);
> >       return 0;
> > --
> > 2.17.1
> >
> > _______________________________________________
> > amd-gfx mailing list
> > amd-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2018-10-10 19:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-08 16:22 [PATCH][drm-next] drm/amdgpu/powerplay: fix missing break in switch statements Colin King
2018-10-09 10:43 ` Huang Rui
2018-10-10 19:08   ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).