Skip to contentSkip to conversation

Hw: char: Remove unnecessary variable

PATCH Applied Shraddha Barke 3 participants 6 messages Sep 25, 2015 – Oct 8, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Hw: char: Remove unnecessary variable

Compress lines and remove the variable.

Change made using Coccinelle script

@@
expression ret;
@@
- if (ret) return ret;
- return 0;
+ return ret;
@@
local idexpression ret;
expression e;
@@
- ret = e;
- return ret;
+ return e;
@@
type T; identifier i;
@@
- T i;
... when != i

---
 hw/char/etraxfs_ser.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
hw/char/etraxfs_ser.c +1 -3
index 857c136..562021e 100644
@@ -182,15 +182,13 @@ static void serial_receive(void *opaque, const uint8_t *buf, int size)
 static int serial_can_receive(void *opaque)
 {
     ETRAXSerial *s = opaque;
-    int r;
 
     /* Is the receiver enabled?  */
     if (!(s->regs[RW_REC_CTRL] & (1 << 3))) {
         return 0;
     }
 
-    r = sizeof(s->rx_fifo) - s->rx_fifo_len;
-    return r;
+    return sizeof(s->rx_fifo) - s->rx_fifo_len;
 }
 
 static void serial_event(void *opaque, int event)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/2 Hw: timer: Remove unnecessary variable

Compress lines and remove the variable.

Change made using Coccinelle script

@@
expression ret;
@@
- if (ret) return ret;
- return 0;
+ return ret;
@@
local idexpression ret;
expression e;
@@
- ret = e;
- return ret;
+ return e;
@@
type T; identifier i;
@@
- T i;
... when != i

---
 hw/timer/m48t59.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
hw/timer/m48t59.c +1 -3
index 8ab683d..b3df8f9 100644
@@ -590,10 +590,8 @@ static void nvram_writel (void *opaque, hwaddr addr, uint32_t value)
 static uint32_t nvram_readb (void *opaque, hwaddr addr)
 {
     M48t59State *NVRAM = opaque;
-    uint32_t retval;
 
-    retval = m48t59_read(NVRAM, addr);
-    return retval;
+    return m48t59_read(NVRAM, addr);
 }
 
 static uint32_t nvram_readw (void *opaque, hwaddr addr)
Signature · 1 line
2.1.4
#2 lore raw

Re: [Qemu-devel] [PATCH 2/2] Hw: timer: Remove unnecessary variable

Quoted 1 line · Shraddha Barke

Compress lines and remove the variable.

Applied to -trivial, removing the Coccinelle script from the commit message.

Thanks,

/mjt

#3 lore raw

Re: [Qemu-devel] [PATCH 2/2] Hw: timer: Remove unnecessary variable

Quoted 5 lines · Michael Tokarev
Quoted 1 line · Shraddha Barke

Compress lines and remove the variable.

Applied to -trivial, removing the Coccinelle script from the commit message.

Why cripple the commit message? The coccinelle recipe is useful for someone trying to backport the script to a different branch where a straight backport doesn't quite work, but rerunning the coccinelle recipe does.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#4 lore raw

Re: [Qemu-devel] [PATCH 2/2] Hw: timer: Remove unnecessary variable

Quoted 11 lines · Eric Blake
Quoted 5 lines · Michael Tokarev
Quoted 1 line · Shraddha Barke

Compress lines and remove the variable.

Applied to -trivial, removing the Coccinelle script from the commit message.

Why cripple the commit message? The coccinelle recipe is useful for someone trying to backport the script to a different branch where a straight backport doesn't quite work, but rerunning the coccinelle recipe does.

I already answered to this one. Becuase git commit messages are not a good place to store various good scripts and recipes like this, and these scripts wont be found there anyway. On the other hand, cluttering commit messages with such info makes is significantly more difficult to find changes when you look for breakage or actual changes somewhere.

Additionally, your point about backporting is kind of moot, there's very very little reason to backport these changes (especially using the supplied script), and if the backporting is really necessary and the patch does not apply (which is twice unlikely) it is much easier to do the patching manually based on the very smal difference here.

Thanks,

/mjt