diff mbox

[2/3] Hw: timer: Remove unnecessary variable

Message ID 1443170278-9318-2-git-send-email-shraddha.6596@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shraddha Barke Sept. 25, 2015, 8:37 a.m. UTC
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

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 hw/timer/tusb6010.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Peter Maydell Sept. 25, 2015, 9:35 p.m. UTC | #1
On 25 September 2015 at 01:37, Shraddha Barke <shraddha.6596@gmail.com> wrote:
> Compress lines and remove the variable ret.
>
> Change made using Coccinelle script

> diff --git a/hw/timer/tusb6010.c b/hw/timer/tusb6010.c
> index 459c748..ba01050 100644
> --- a/hw/timer/tusb6010.c
> +++ b/hw/timer/tusb6010.c
> @@ -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;
>

This change would break the #if-0'd out code if we ever reenabled it.

-- PMM
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/hw/timer/tusb6010.c b/hw/timer/tusb6010.c
index 459c748..ba01050 100644
--- a/hw/timer/tusb6010.c
+++ b/hw/timer/tusb6010.c
@@ -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;