Skip to contentSkip to conversation

x86: remove dead code in intel_clk_get_rate()

PATCH New Heinrich Schuchardt 4 participants 4 messages Feb 15, 2020 – Feb 20, 2020 Common clk

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: remove dead code in intel_clk_get_rate()

If all branches of a switch statement have a return instruction, all subsequent lines are unreachable.

Identified with cppcheck.

---
 drivers/clk/intel/clk_intel.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/clk/intel/clk_intel.c +0 -4
index d2e15491a3..b633934d90 100644
@@ -11,8 +11,6 @@
 
 static ulong intel_clk_get_rate(struct clk *clk)
 {
-	ulong rate;
-
 	switch (clk->id) {
 	case CLK_I2C:
 		/* Hard-coded to 133MHz on current platforms */
@@ -20,8 +18,6 @@ static ulong intel_clk_get_rate(struct clk *clk)
 	default:
 		return -ENODEV;
 	}
-
-	return rate;
 }
 
 static struct clk_ops intel_clk_ops = {

--
2.25.0

#1 lore raw

PATCH 1/1 x86: remove dead code in intel_clk_get_rate()

Quoted 33 lines · On Sat, 15 Feb 2020 21:22:00 +0100 Heinrich Schuchardt <[email protected]>…

If all branches of a switch statement have a return instruction, all subsequent lines are unreachable.

Identified with cppcheck.

---
 drivers/clk/intel/clk_intel.c | 4 ----
 1 file changed, 4 deletions(-)
(quoted diff) +0 -0

b/drivers/clk/intel/clk_intel.c index d2e15491a3..b633934d90 100644

drivers/clk/intel/clk_intel.c +0 -5
@@ -11,8 +11,6 @@
 
 static ulong intel_clk_get_rate(struct clk *clk)
 {
-	ulong rate;
-
 	switch (clk->id) {
 	case CLK_I2C:
 		/* Hard-coded to 133MHz on current platforms */
@@ -20,8 +18,6 @@ static ulong intel_clk_get_rate(struct clk *clk)
 	default:
 		return -ENODEV;
 	}
-
-	return rate;
 }
 
 static struct clk_ops intel_clk_ops = {
--
Quoted 2 lines

2.25.0

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200216/04d7158d/attachment.sig>

#3 lore raw

PATCH 1/1 x86: remove dead code in intel_clk_get_rate()

In reply to Heinrich Schuchardt
Quoted 11 lines · Heinrich Schuchardt

If all branches of a switch statement have a return instruction, all subsequent lines are unreachable.

Identified with cppcheck.

---
 drivers/clk/intel/clk_intel.c | 4 ----
 1 file changed, 4 deletions(-)

applied to u-boot-x86, thanks!