Target-microblaze: Remove unnecessary variable
PATCH 1/3 Target-microblaze: 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
--- target-microblaze/op_helper.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
target-microblaze/op_helper.c +1 -3
@@ -151,9 +151,7 @@ uint32_t helper_clz(uint32_t t0)uint32_t helper_carry (uint32_t a,uint32_t b,uint32_t cf) { -uint32_t ncf; - ncf =compute_carry (a, b, cf); -return ncf; +return compute_carry (a, b, cf); }static inline int div_prepare (CPUMBState *env,uint32_t a,uint32_t b)
Signature · 1 line
2.1.4
PATCH 2/3 Hw: timer: Remove unnecessary variable
Compress lines and remove the variable ret.
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/tusb6010.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
hw/timer/tusb6010.c +1 -3
@@ -321,7 +321,6 @@ static uint32_t tusb_async_readw(void *opaque, hwaddr addr)TUSBState *s = (TUSBState *) opaque;int offset = addr &0xfff ;int epnum; -uint32_t ret;switch (offset) {case TUSB_DEV_CONF :
@@ -338,12 +337,11 @@ static uint32_t tusb_async_readw(void *opaque, hwaddr addr)return 0x00 ;/* TODO */ case TUSB_DEV_OTG_STAT : - ret = s->otg_status;#if 0 if (!(s->prcm_mngmt &TUSB_PRCM_MNGMT_OTG_VBUS_DET_EN )) ret &= ~TUSB_DEV_OTG_STAT_VBUS_VALID ;#endif -return ret; +return s->otg_status;case TUSB_DEV_OTG_TIMER :return s->otg_timer_val;
Signature · 1 line
2.1.4
PATCH 3/3 Target-ppc: Remove unnecessary variable
In reply to Shraddha BarkeCompress 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
--- target-ppc/kvm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
target-ppc/kvm.c +1 -2
@@ -1782,8 +1782,7 @@ uint32_t kvmppc_get_tbfreq(void) ns++; - retval =atoi (ns); -return retval; +return atoi (ns); }bool kvmppc_get_host_serial (char **value)
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 2/3] Hw: timer: Remove unnecessary variable
In reply to Shraddha BarkeQuoted 20 lines · Shraddha Barke
Compress lines and remove the variable ret.
Change made using Coccinelle script
hw/timer/tusb6010.c +0
-1@@ -321,7 +321,6 @@ static uint32_t tusb_async_readw(void *opaque, hwaddr addr)TUSBState *s = (TUSBState *) opaque;int offset = addr &0xfff ;int epnum; -uint32_t ret;switch (offset) {case TUSB_DEV_CONF :@@ -338,12 +337,11 @@ static uint32_t tusb_async_readw(void *opaque, hwaddr addr)return 0x00 ;/* TODO */ case TUSB_DEV_OTG_STAT :
hw/timer/tusb6010.c static uint32_t tusb_async_readw(void *opaque, hwaddr addr) · line 347
Quoted 10 lines
hw/timer/tusb6010.c +1
-2- ret = s->otg_status;#if 0 if (!(s->prcm_mngmt &TUSB_PRCM_MNGMT_OTG_VBUS_DET_EN )) ret &= ~TUSB_DEV_OTG_STAT_VBUS_VALID ;#endif -return ret; +return s->otg_status;case TUSB_DEV_OTG_TIMER :return s->otg_timer_val;
This change would break the #if-0'd out code if we ever reenabled it.
-- PMM
Re: [Qemu-devel] [PATCH 3/3] Target-ppc: Remove unnecessary variable
In reply to Shraddha Barketarget-ppc/kvm.c uint32_t kvmppc_get_tbfreq(void) · line 1785
Quoted 11 lines · Shraddha Barke
Compress lines and remove the variable.
+++
b/target-ppc/kvm.ctarget-ppc/kvm.c +1
-2@@ -1782,8 +1782,7 @@ uint32_t kvmppc_get_tbfreq(void) ns++; - retval =atoi (ns); -return retval; +return atoi (ns);
atoi() is lousy; it cannot properly detect user input errors. This should probably be converted to use the appropriate qemu_strtol variant instead.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Paolo Bonzini
maintainerRe: [Qemu-devel] [PATCH 3/3] Target-ppc: Remove unnecessary variable
Quoted 9 lines · Eric Blake
Quoted 8 lines · Shraddha Barke
Compress lines and remove the variable.
+++
b/target-ppc/kvm.c(quoted diff) +0
-0@@ -1782,8 +1782,7 @@ uint32_t kvmppc_get_tbfreq(void) ns++;
Quoted 7 lines
target-ppc/kvm.c uint32_t kvmppc_get_tbfreq(void) · line 1785
Quoted 3 lines
target-ppc/kvm.c +1
-2- retval =atoi (ns); -return retval; +return atoi (ns);
atoi()is lousy; it cannot properly detect user input errors. This should probably be converted to use the appropriateqemu_strtolvariant instead.
But it's more or less okay here, it's parsing /proc/cpuinfo.
Paolo
Michael Tokarev
AppliedQuoted 1 line · Shraddha Barke
Compress lines and remove the variable .
Applied to -trivial, removing this piece of commit message:
---
Quoted 12 lines
Change made using Coccinelle script
@@
expression ret;
@@
- if (ret) return ret;
- return 0;
+ return ret;
@@
local idexpression ret;
expression e;
@@
Quoted 8 lines
- ret = e;
- return ret;
+ return e;
@@
type T; identifier i;
@@
- T i;
... when != i
---
Thanks,
/mjt
Michael Tokarev
AppliedRe: [PATCH 3/3] Target-ppc: Remove unnecessary variable
In reply to Shraddha BarkeQuoted 1 line · Shraddha Barke
Compress lines and remove the variable.
Applied to -trivial, removing this piece of commit message:
---
Quoted 12 lines
Change made using Coccinelle script
@@
expression ret;
@@
- if (ret) return ret;
- return 0;
+ return ret;
@@
local idexpression ret;
expression e;
@@
Quoted 8 lines
- ret = e;
- return ret;
+ return e;
@@
type T; identifier i;
@@
- T i;
... when != i
---
Thanks,
/mjt
Quoted 26 lines · Michael Tokarev
Quoted 1 line · Shraddha Barke
Compress lines and remove the variable .
Applied to -trivial, removing this piece of commit message:
---
Quoted 12 lines
Change made using Coccinelle script
@@
expression ret;
@@
- if (ret) return ret;
- return 0;
+ return ret;
@@
local idexpression ret;
expression e;
@@Quoted 8 lines
- ret = e;
- return ret;
+ return e;
@@
type T; identifier i;
@@
- T i;
... when != i
Quoted 1 line
---
Why? I like having the semantic patch in the commit message when there's any chance we'll want do the same mechanical change again later.
You could save space and include it by reference, though: "Same Coccinelle semantic patch as is commit 74c373e".
Quoted 9 lines · Markus Armbruster
Quoted 7 lines · Michael Tokarev
Quoted 1 line · Shraddha Barke
Compress lines and remove the variable .
Applied to -trivial, removing this piece of commit message:
---
Quoted 1 line
Change made using Coccinelle script
[..snip..]
Quoted 7 lines
Quoted 1 line
---
Why? I like having the semantic patch in the commit message when there's any chance we'll want do the same mechanical change again later.
You could save space and include it by reference, though: "Same Coccinelle semantic patch as is commit 74c373e".
git commit messages aren't good documentation for various scripts like this, this info will be lost in the noize. If it might be better to keep such scripts in a separate file where it is easier to find, or in a wiki page on the site. The key point is where to find the info, git log is difficult for that, especially when you don't know what to search for or that such a script exists in there in the first place.
On the other hand, when git log is cluttered by such a long messages for such small changes, it becomes more difficult to find info which you really look in git log -- namely, which changes were made that might have introduced this regression, things like that.
So to me, the shorter and cleaner the commit message is, the better.
BTW, I've no idea why this email has been Cc'd to kvm@vger :)
Thanks,
/mjt
Quoted 15 lines · Michael Tokarev
Quoted 5 lines · Markus Armbruster
Why? I like having the semantic patch in the commit message when there's any chance we'll want do the same mechanical change again later.
You could save space and include it by reference, though: "Same Coccinelle semantic patch as is commit 74c373e".
git commit messages aren't good documentation for various scripts like this, this info will be lost in the noize. If it might be better to keep such scripts in a separate file where it is easier to find, or in a wiki page on the site. The key point is where to find the info, git log is difficult for that, especially when you don't know what to search for or that such a script exists in there in the first place.
Quoted 4 lines
On the other hand, when git log is cluttered by such a long messages for such small changes, it becomes more difficult to find info which you really look in git log -- namely, which changes were made that might have introduced this regression, things like that.
I think it can be useful when you're looking at a commit to know that it was automatically created, especially if it's a big commit. It means that if you're looking for a bug in it you can concentrate on the script that created it rather than the possibly large set of changes it produced, or if you're trying to cherry-pick it into another branch you can just apply the script instead.
In a commit with a change this small it's not very significant either way, though.
thanks
-- PMM