qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/4] Remove superfluous return statements
@ 2015-11-10 20:16 Thomas Huth
  2015-11-10 20:16 ` [Qemu-devel] [PATCH 1/4] hw/ide: " Thomas Huth
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Thomas Huth @ 2015-11-10 20:16 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial

Some functions in QEMU have a "return;" statement at the
very end of a function with "void" return type, i.e. the
return statement is superfluous. This patch series removes
some of them.

Thomas Huth (4):
  hw/ide: Remove superfluous return statements
  hw/acpi: Remove superfluous return statement
  hw/s390x: Remove superfluous return statements
  hw/core/qdev: Remove superfluous return statement

 hw/acpi/memory_hotplug.c  |  1 -
 hw/core/qdev.c            |  1 -
 hw/ide/atapi.c            |  1 -
 hw/ide/macio.c            |  2 --
 hw/s390x/css.c            |  1 -
 hw/s390x/event-facility.c | 21 ++++++---------------
 hw/s390x/s390-pci-bus.c   |  4 ----
 7 files changed, 6 insertions(+), 25 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH 1/4] hw/ide: Remove superfluous return statements
  2015-11-10 20:16 [Qemu-devel] [PATCH 0/4] Remove superfluous return statements Thomas Huth
@ 2015-11-10 20:16 ` Thomas Huth
  2015-11-10 20:17   ` John Snow
  2015-11-10 20:16 ` [Qemu-devel] [PATCH 2/4] hw/acpi: Remove superfluous return statement Thomas Huth
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Thomas Huth @ 2015-11-10 20:16 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: John Snow, qemu-block

The "return;" statements at the end of functions do not make
much sense, so let's remove them.

Cc: John Snow <jsnow@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/ide/atapi.c | 1 -
 hw/ide/macio.c | 2 --
 2 files changed, 3 deletions(-)

diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 747f466..347c6e7 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -737,7 +737,6 @@ static void cmd_inquiry(IDEState *s, uint8_t *buf)
  out:
     buf[size_idx] = idx - preamble_len;
     ide_atapi_cmd_reply(s, idx, max_len);
-    return;
 }
 
 static void cmd_get_configuration(IDEState *s, uint8_t *buf)
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index 893c9b9..8a56115 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -288,8 +288,6 @@ static void pmac_ide_atapi_transfer_cb(void *opaque, int ret)
 done:
     block_acct_done(blk_get_stats(s->blk), &s->acct);
     io->dma_end(opaque);
-
-    return;
 }
 
 static void pmac_ide_transfer_cb(void *opaque, int ret)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH 2/4] hw/acpi: Remove superfluous return statement
  2015-11-10 20:16 [Qemu-devel] [PATCH 0/4] Remove superfluous return statements Thomas Huth
  2015-11-10 20:16 ` [Qemu-devel] [PATCH 1/4] hw/ide: " Thomas Huth
@ 2015-11-10 20:16 ` Thomas Huth
  2015-11-10 20:16 ` [Qemu-devel] [PATCH 3/4] hw/s390x: Remove superfluous return statements Thomas Huth
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Thomas Huth @ 2015-11-10 20:16 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: Igor Mammedov, Michael S. Tsirkin

The "return;" statement at the end of acpi_memory_plug_cb()
does not make much sense, so let's remove it.

Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/acpi/memory_hotplug.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
index ce428df..bca7c54 100644
--- a/hw/acpi/memory_hotplug.c
+++ b/hw/acpi/memory_hotplug.c
@@ -244,7 +244,6 @@ void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st,
         /* do ACPI magic */
         acpi_send_gpe_event(ar, irq, ACPI_MEMORY_HOTPLUG_STATUS);
     }
-    return;
 }
 
 void acpi_memory_unplug_request_cb(ACPIREGS *ar, qemu_irq irq,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH 3/4] hw/s390x: Remove superfluous return statements
  2015-11-10 20:16 [Qemu-devel] [PATCH 0/4] Remove superfluous return statements Thomas Huth
  2015-11-10 20:16 ` [Qemu-devel] [PATCH 1/4] hw/ide: " Thomas Huth
  2015-11-10 20:16 ` [Qemu-devel] [PATCH 2/4] hw/acpi: Remove superfluous return statement Thomas Huth
@ 2015-11-10 20:16 ` Thomas Huth
  2015-11-11 11:25   ` Cornelia Huck
  2015-11-10 20:16 ` [Qemu-devel] [PATCH 4/4] hw/core/qdev: Remove superfluous return statement Thomas Huth
  2016-01-11  8:29 ` [Qemu-devel] [PATCH 0/4] Remove superfluous return statements Michael Tokarev
  4 siblings, 1 reply; 9+ messages in thread
From: Thomas Huth @ 2015-11-10 20:16 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial
  Cc: Cornelia Huck, Christian Borntraeger, Alexander Graf,
	Richard Henderson

The "return;" statements at the end of functions do not make
much sense, so let's remove them.

Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Alexander Graf <agraf@suse.de>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/s390x/css.c            |  1 -
 hw/s390x/event-facility.c | 21 ++++++---------------
 hw/s390x/s390-pci-bus.c   |  4 ----
 3 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index c033612..48ba1fd 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -1424,7 +1424,6 @@ void subch_device_save(SubchDev *s, QEMUFile *f)
     }
     qemu_put_byte(f, s->ccw_fmt_1);
     qemu_put_byte(f, s->ccw_no_data_cnt);
-    return;
 }
 
 int subch_device_load(SubchDev *s, QEMUFile *f)
diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c
index 907b485..7551685 100644
--- a/hw/s390x/event-facility.c
+++ b/hw/s390x/event-facility.c
@@ -158,11 +158,11 @@ static void write_event_data(SCLPEventFacility *ef, SCCB *sccb)
 {
     if (sccb->h.function_code != SCLP_FC_NORMAL_WRITE) {
         sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_FUNCTION);
-        goto out;
+        return;
     }
     if (be16_to_cpu(sccb->h.length) < 8) {
         sccb->h.response_code = cpu_to_be16(SCLP_RC_INSUFFICIENT_SCCB_LENGTH);
-        goto out;
+        return;
     }
     /* first do a sanity check of the write events */
     sccb->h.response_code = cpu_to_be16(write_event_length_check(sccb));
@@ -172,9 +172,6 @@ static void write_event_data(SCLPEventFacility *ef, SCCB *sccb)
         sccb->h.response_code =
                 cpu_to_be16(handle_sccb_write_events(ef, sccb));
     }
-
-out:
-    return;
 }
 
 static uint16_t handle_sccb_read_events(SCLPEventFacility *ef, SCCB *sccb,
@@ -227,7 +224,7 @@ static void read_event_data(SCLPEventFacility *ef, SCCB *sccb)
 
     if (be16_to_cpu(sccb->h.length) != SCCB_SIZE) {
         sccb->h.response_code = cpu_to_be16(SCLP_RC_INSUFFICIENT_SCCB_LENGTH);
-        goto out;
+        return;
     }
 
     sclp_cp_receive_mask = ef->receive_mask;
@@ -243,18 +240,15 @@ static void read_event_data(SCLPEventFacility *ef, SCCB *sccb)
             (sclp_active_selection_mask & ~sclp_cp_receive_mask)) {
             sccb->h.response_code =
                     cpu_to_be16(SCLP_RC_INVALID_SELECTION_MASK);
-            goto out;
+            return;
         }
         break;
     default:
         sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_FUNCTION);
-        goto out;
+        return;
     }
     sccb->h.response_code = cpu_to_be16(
             handle_sccb_read_events(ef, sccb, sclp_active_selection_mask));
-
-out:
-    return;
 }
 
 static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb)
@@ -265,7 +259,7 @@ static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb)
        does. Architecture allows for masks of variable size, though */
     if (be16_to_cpu(we_mask->mask_length) != 4) {
         sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_MASK_LENGTH);
-        goto out;
+        return;
     }
 
     /* keep track of the guest's capability masks */
@@ -276,9 +270,6 @@ static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb)
     we_mask->receive_mask = cpu_to_be32(get_host_receive_mask(ef));
 
     sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_COMPLETION);
-
-out:
-    return;
 }
 
 /* qemu object creation and initialization functions */
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 560b66a..6be699b 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -123,7 +123,6 @@ void s390_pci_sclp_configure(int configure, SCCB *sccb)
     }
 
     psccb->header.response_code = cpu_to_be16(rc);
-    return;
 }
 
 static uint32_t s390_pci_get_pfid(PCIDevice *pdev)
@@ -435,8 +434,6 @@ static void s390_msi_ctrl_write(void *opaque, hwaddr addr, uint64_t data,
         io_int_word = (pbdev->isc << 27) | IO_INT_WORD_AI;
         s390_io_interrupt(0, 0, 0, io_int_word);
     }
-
-    return;
 }
 
 static uint64_t s390_msi_ctrl_read(void *opaque, hwaddr addr, unsigned size)
@@ -539,7 +536,6 @@ static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev,
         s390_pci_generate_plug_event(HP_EVENT_TO_CONFIGURED,
                                      pbdev->fh, pbdev->fid);
     }
-    return;
 }
 
 static void s390_pcihost_hot_unplug(HotplugHandler *hotplug_dev,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH 4/4] hw/core/qdev: Remove superfluous return statement
  2015-11-10 20:16 [Qemu-devel] [PATCH 0/4] Remove superfluous return statements Thomas Huth
                   ` (2 preceding siblings ...)
  2015-11-10 20:16 ` [Qemu-devel] [PATCH 3/4] hw/s390x: Remove superfluous return statements Thomas Huth
@ 2015-11-10 20:16 ` Thomas Huth
  2016-01-11  8:29 ` [Qemu-devel] [PATCH 0/4] Remove superfluous return statements Michael Tokarev
  4 siblings, 0 replies; 9+ messages in thread
From: Thomas Huth @ 2015-11-10 20:16 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial

The "return;" statement at the end of device_set_realized()
does not make much sense, so let's remove it.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/core/qdev.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 4ab04aa..d712a0b 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -1129,7 +1129,6 @@ post_realize_fail:
 
 fail:
     error_propagate(errp, local_err);
-    return;
 }
 
 static bool device_get_hotpluggable(Object *obj, Error **errp)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 1/4] hw/ide: Remove superfluous return statements
  2015-11-10 20:16 ` [Qemu-devel] [PATCH 1/4] hw/ide: " Thomas Huth
@ 2015-11-10 20:17   ` John Snow
  0 siblings, 0 replies; 9+ messages in thread
From: John Snow @ 2015-11-10 20:17 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel, qemu-trivial; +Cc: qemu-block



On 11/10/2015 03:16 PM, Thomas Huth wrote:
> The "return;" statements at the end of functions do not make
> much sense, so let's remove them.
> 
> Cc: John Snow <jsnow@redhat.com>
> Cc: qemu-block@nongnu.org
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  hw/ide/atapi.c | 1 -
>  hw/ide/macio.c | 2 --
>  2 files changed, 3 deletions(-)
> 
> diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
> index 747f466..347c6e7 100644
> --- a/hw/ide/atapi.c
> +++ b/hw/ide/atapi.c
> @@ -737,7 +737,6 @@ static void cmd_inquiry(IDEState *s, uint8_t *buf)
>   out:
>      buf[size_idx] = idx - preamble_len;
>      ide_atapi_cmd_reply(s, idx, max_len);
> -    return;
>  }
>  
>  static void cmd_get_configuration(IDEState *s, uint8_t *buf)
> diff --git a/hw/ide/macio.c b/hw/ide/macio.c
> index 893c9b9..8a56115 100644
> --- a/hw/ide/macio.c
> +++ b/hw/ide/macio.c
> @@ -288,8 +288,6 @@ static void pmac_ide_atapi_transfer_cb(void *opaque, int ret)
>  done:
>      block_acct_done(blk_get_stats(s->blk), &s->acct);
>      io->dma_end(opaque);
> -
> -    return;
>  }
>  
>  static void pmac_ide_transfer_cb(void *opaque, int ret)
> 

Fair enough.

Reviewed-by: John Snow <jsnow@redhat.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 3/4] hw/s390x: Remove superfluous return statements
  2015-11-10 20:16 ` [Qemu-devel] [PATCH 3/4] hw/s390x: Remove superfluous return statements Thomas Huth
@ 2015-11-11 11:25   ` Cornelia Huck
  2015-11-11 13:29     ` Thomas Huth
  0 siblings, 1 reply; 9+ messages in thread
From: Cornelia Huck @ 2015-11-11 11:25 UTC (permalink / raw)
  To: Thomas Huth
  Cc: qemu-trivial, Christian Borntraeger, Richard Henderson,
	qemu-devel, Alexander Graf

On Tue, 10 Nov 2015 21:16:10 +0100
Thomas Huth <thuth@redhat.com> wrote:

> The "return;" statements at the end of functions do not make
> much sense, so let's remove them.
> 
> Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: Alexander Graf <agraf@suse.de>
> Cc: Richard Henderson <rth@twiddle.net>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  hw/s390x/css.c            |  1 -
>  hw/s390x/event-facility.c | 21 ++++++---------------
>  hw/s390x/s390-pci-bus.c   |  4 ----
>  3 files changed, 6 insertions(+), 20 deletions(-)
> 

Ack for the css and pci parts.

The sclp parts, however, switch from "one point of exit" to "immediate
exit", and I'm not sure I like that; not sure enough anyway to apply
this patch.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 3/4] hw/s390x: Remove superfluous return statements
  2015-11-11 11:25   ` Cornelia Huck
@ 2015-11-11 13:29     ` Thomas Huth
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Huth @ 2015-11-11 13:29 UTC (permalink / raw)
  To: Cornelia Huck
  Cc: qemu-trivial, Christian Borntraeger, Alexander Graf, qemu-devel,
	Richard Henderson

On 11/11/15 12:25, Cornelia Huck wrote:
> On Tue, 10 Nov 2015 21:16:10 +0100
> Thomas Huth <thuth@redhat.com> wrote:
> 
>> The "return;" statements at the end of functions do not make
>> much sense, so let's remove them.
>>
>> Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
>> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
>> Cc: Alexander Graf <agraf@suse.de>
>> Cc: Richard Henderson <rth@twiddle.net>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>  hw/s390x/css.c            |  1 -
>>  hw/s390x/event-facility.c | 21 ++++++---------------
>>  hw/s390x/s390-pci-bus.c   |  4 ----
>>  3 files changed, 6 insertions(+), 20 deletions(-)
>>
> 
> Ack for the css and pci parts.
> 
> The sclp parts, however, switch from "one point of exit" to "immediate
> exit", and I'm not sure I like that; not sure enough anyway to apply
> this patch.

Ah, right, I remember, you're prefering gotos ... well, no, I won't
start a discussion about that here again ;-) ... so feel free to remove
these hunks or simply ignore the patch completely.

 Cheers,
  Thomas

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 0/4] Remove superfluous return statements
  2015-11-10 20:16 [Qemu-devel] [PATCH 0/4] Remove superfluous return statements Thomas Huth
                   ` (3 preceding siblings ...)
  2015-11-10 20:16 ` [Qemu-devel] [PATCH 4/4] hw/core/qdev: Remove superfluous return statement Thomas Huth
@ 2016-01-11  8:29 ` Michael Tokarev
  4 siblings, 0 replies; 9+ messages in thread
From: Michael Tokarev @ 2016-01-11  8:29 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel, qemu-trivial

10.11.2015 23:16, Thomas Huth wrote:
> Some functions in QEMU have a "return;" statement at the
> very end of a function with "void" return type, i.e. the
> return statement is superfluous. This patch series removes
> some of them.
> 
> Thomas Huth (4):
>   hw/ide: Remove superfluous return statements
>   hw/acpi: Remove superfluous return statement
>   hw/s390x: Remove superfluous return statements
>   hw/core/qdev: Remove superfluous return statement

(Finally!) applied to -trivial, after removing changes
to hw/s390x/event-facility.c from hw/s390x patch as
discussed before.

Thank you, and please excuse me it took so long :)

/mjt

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-01-11  8:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-10 20:16 [Qemu-devel] [PATCH 0/4] Remove superfluous return statements Thomas Huth
2015-11-10 20:16 ` [Qemu-devel] [PATCH 1/4] hw/ide: " Thomas Huth
2015-11-10 20:17   ` John Snow
2015-11-10 20:16 ` [Qemu-devel] [PATCH 2/4] hw/acpi: Remove superfluous return statement Thomas Huth
2015-11-10 20:16 ` [Qemu-devel] [PATCH 3/4] hw/s390x: Remove superfluous return statements Thomas Huth
2015-11-11 11:25   ` Cornelia Huck
2015-11-11 13:29     ` Thomas Huth
2015-11-10 20:16 ` [Qemu-devel] [PATCH 4/4] hw/core/qdev: Remove superfluous return statement Thomas Huth
2016-01-11  8:29 ` [Qemu-devel] [PATCH 0/4] Remove superfluous return statements Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).