[4/6] p9/stop_api: Remove unnecessary stores

Message ID 20180517233105.8243-5-bsingharora@gmail.com
State New
Headers show
Series
  • scan build fixes
Related show

Commit Message

Balbir singh May 17, 2018, 11:31 p.m.
Caught by scan-build, good compilers will optimise them away
anyway, but it's good to not have unnecessary code to begin
with. I guess we need to propagate these fixes back to other
sources, so that our rebasing is easy in the future.

Signed-off-by: Balbir singh <bsingharora@gmail.com>
---
 libpore/p9_stop_api.C | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Patch

diff --git a/libpore/p9_stop_api.C b/libpore/p9_stop_api.C
index 5c0f2e5e..c1a731f5 100644
--- a/libpore/p9_stop_api.C
+++ b/libpore/p9_stop_api.C
@@ -182,8 +182,8 @@  static StopReturnCode_t validateSprImageInputs( void*   const i_pImage,
 static uint32_t getOriInstruction( const uint16_t i_Rs, const uint16_t i_Ra,
                                    const uint16_t i_data )
 {
-    uint32_t oriInstOpcode = 0;
-    oriInstOpcode = 0;
+    uint32_t oriInstOpcode;
+
     oriInstOpcode = ORI_OPCODE << 26;
     oriInstOpcode |= i_Rs << 21;
     oriInstOpcode |= i_Ra << 16;
@@ -237,7 +237,7 @@  static uint32_t getOrisInstruction( const uint16_t i_Rs, const uint16_t i_Ra,
                                     const uint16_t i_data )
 {
     uint32_t orisInstOpcode;
-    orisInstOpcode = 0;
+
     orisInstOpcode = ORIS_OPCODE << 26;
     orisInstOpcode |= ( i_Rs & 0x001F ) << 21 | ( i_Ra & 0x001F ) << 16;
     orisInstOpcode |= i_data;
@@ -278,8 +278,8 @@  static uint32_t getMtsprInstruction( const uint16_t i_Rs, const uint16_t i_Spr )
 static uint32_t getRldicrInstruction( const uint16_t i_Ra, const uint16_t i_Rs,
                                       const uint16_t i_sh, uint16_t i_me )
 {
-    uint32_t rldicrInstOpcode = 0;
-    rldicrInstOpcode = 0;
+    uint32_t rldicrInstOpcode;
+
     rldicrInstOpcode = ((RLDICR_OPCODE << 26 ) | ( i_Rs << 21 ) | ( i_Ra << 16 ));
     rldicrInstOpcode |= ( ( i_sh & 0x001F ) << 11 ) | (RLDICR_CONST << 2 );
     rldicrInstOpcode |= (( i_sh & 0x0020 ) >> 4);
@@ -412,7 +412,6 @@  static StopReturnCode_t updateSprEntryInImage( uint32_t* i_pSprEntryLocation,
         *i_pSprEntryLocation = tempInst;
         i_pSprEntryLocation += SIZE_PER_SPR_RESTORE_INST;
 
-        tempRegData = (uint16_t)i_regData;
         //get bit b48-b63 of SPR restore value to R0
         tempInst = getOriInstruction( regRs, regRa, (uint16_t)i_regData );
         *i_pSprEntryLocation = tempInst;