Skip to contentSkip to conversation

Coccinelle cleanups

PATCH Superseded Philippe Mathieu-Daudé 8 participants 26 messages Jul 4, 2018 – Aug 21, 2018 Crypto API

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Coccinelle cleanups

Nothing exciting here, patches created mechanically (common after soft freeze).

Philippe Mathieu-Daudé (8):
qobject: Catch another straggler for use of qdict_put_str()
error: Remove NULL checks on error_propagate() calls
crypto: Remove useless casts
xen: Remove useless casts
tests/bios-tables-test: Remove useless casts
ui/vnc: Remove useless parenthesis around DIV_ROUND_UP macro hw/pci-host: Remove useless parenthesis around DIV_ROUND_UP macro hw/intc/gicv3: Remove useless parenthesis around DIV_ROUND_UP macro

 include/hw/intc/arm_gicv3_common.h | 2 +-
 crypto/cipher-builtin.c            | 4 ++--
 hw/pci-host/piix.c                 | 2 +-
 hw/pci-host/q35.c                  | 2 +-
 hw/s390x/virtio-ccw.c              | 4 +---
 hw/xen/xen_pt_config_init.c        | 2 +-
 qobject/block-qdict.c              | 2 +-
 tests/bios-tables-test.c           | 2 +-
 ui/vnc-enc-tight.c                 | 2 +-
 ui/vnc.c                           | 3 ++-
 10 files changed, 12 insertions(+), 13 deletions(-)
Signature · 7 lines
2.18.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH 1/8 qobject: Catch another straggler for use of qdict_put_str()

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/qobject.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 qobject/block-qdict.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qobject/block-qdict.c +1 -1
index 80c653013f..ae363708ab 100644
@@ -572,7 +572,7 @@ static QObject *qdict_crumple_for_keyval_qiv(QDict *src, Error **errp)
         if (!tmp) {
             tmp = qdict_clone_shallow(src);
         }
-        qdict_put(tmp, ent->key, qstring_from_str(s));
+        qdict_put_str(tmp, ent->key, s);
         g_free(buf);
     }
 
Signature · 1 line
2.18.0
Reviewed-by on v1 1/8
#2 lore raw

Re: [Qemu-devel] [PATCH 1/8] qobject: Catch another straggler for use of qdict_put_str()

Quoted 16 lines · Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/qobject.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 qobject/block-qdict.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qobject/block-qdict.c +0 -0
index 80c653013f..ae363708ab 100644

qobject/block-qdict.c static QObject *qdict_crumple_for_keyval_qiv(QDict *src, Error **errp) · line 577

Quoted 7 lines
qobject/block-qdict.c +1 -1
@@ -572,7 +572,7 @@ static QObject *qdict_crumple_for_keyval_qiv(QDict *src, Error **errp)
         if (!tmp) {
             tmp = qdict_clone_shallow(src);
         }
-        qdict_put(tmp, ent->key, qstring_from_str(s));
+        qdict_put_str(tmp, ent->key, s);
         g_free(buf);
     }
#3 lore raw

PATCH 2/8 error: Remove NULL checks on error_propagate() calls

In reply to Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/error_propagate_null.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 hw/s390x/virtio-ccw.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
hw/s390x/virtio-ccw.c +1 -3
index b92a85d0b0..7ddb378d52 100644
@@ -1836,11 +1836,9 @@ static void vhost_vsock_ccw_realize(VirtioCcwDevice *ccw_dev, Error **errp)
 {
     VHostVSockCCWState *dev = VHOST_VSOCK_CCW(ccw_dev);
     DeviceState *vdev = DEVICE(&dev->vdev);
-    Error *err = NULL;
 
     qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
-    object_property_set_bool(OBJECT(vdev), true, "realized", &err);
-    error_propagate(errp, err);
+    object_property_set_bool(OBJECT(vdev), true, "realized", errp);
 }
 
 static void vhost_vsock_ccw_class_init(ObjectClass *klass, void *data)
Signature · 1 line
2.18.0
Reviewed-by on v1 2/8
#4 lore raw

Re: [Qemu-devel] [PATCH 2/8] error: Remove NULL checks on error_propagate() calls

Quoted 18 lines · Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/error_propagate_null.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 hw/s390x/virtio-ccw.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
hw/s390x/virtio-ccw.c +0 -0
index b92a85d0b0..7ddb378d52 100644
@@ -1836,11 +1836,9 @@ static void vhost_vsock_ccw_realize(VirtioCcwDevice *ccw_dev, Error **errp)
 {
     VHostVSockCCWState *dev = VHOST_VSOCK_CCW(ccw_dev);

hw/s390x/virtio-ccw.c static void vhost_vsock_ccw_realize(VirtioCcwDevice *ccw_dev, Error **errp) · line 1844

Quoted 10 lines
hw/s390x/virtio-ccw.c +1 -3
     DeviceState *vdev = DEVICE(&dev->vdev);
-    Error *err = NULL;
 
     qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
-    object_property_set_bool(OBJECT(vdev), true, "realized", &err);
-    error_propagate(errp, err);
+    object_property_set_bool(OBJECT(vdev), true, "realized", errp);
 }
 
 static void vhost_vsock_ccw_class_init(ObjectClass *klass, void *data)
Reviewed-by on v1 2/8
#5 lore raw

Re: [Qemu-devel] [PATCH 2/8] error: Remove NULL checks on error_propagate() calls

In reply to Philippe Mathieu-Daudé
Quoted 19 lines · Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/error_propagate_null.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 hw/s390x/virtio-ccw.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
hw/s390x/virtio-ccw.c +0 -0
index b92a85d0b0..7ddb378d52 100644
@@ -1836,11 +1836,9 @@ static void vhost_vsock_ccw_realize(VirtioCcwDevice *ccw_dev, Error **errp)
 {
     VHostVSockCCWState *dev = VHOST_VSOCK_CCW(ccw_dev);

hw/s390x/virtio-ccw.c static void vhost_vsock_ccw_realize(VirtioCcwDevice *ccw_dev, Error **errp) · line 1844

Quoted 10 lines
hw/s390x/virtio-ccw.c +1 -3
     DeviceState *vdev = DEVICE(&dev->vdev);
-    Error *err = NULL;
 
     qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
-    object_property_set_bool(OBJECT(vdev), true, "realized", &err);
-    error_propagate(errp, err);
+    object_property_set_bool(OBJECT(vdev), true, "realized", errp);
 }
 
 static void vhost_vsock_ccw_class_init(ObjectClass *klass, void *data)
Signature · 3 lines
Thanks,

David / dhildenb
#6 lore raw

PATCH 3/8 crypto: Remove useless casts

In reply to Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/typecast.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 crypto/cipher-builtin.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
crypto/cipher-builtin.c +2 -2
index d8c811fd33..7eff760f0a 100644
@@ -133,7 +133,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx,
 {
     const QCryptoCipherBuiltinAESContext *aesctx = ctx;
 
-    qcrypto_cipher_aes_ecb_encrypt((AES_KEY *)&aesctx->enc,
+    qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc,
                                    src, dst, length);
 }
 
@@ -145,7 +145,7 @@ static void qcrypto_cipher_aes_xts_decrypt(const void *ctx,
 {
     const QCryptoCipherBuiltinAESContext *aesctx = ctx;
 
-    qcrypto_cipher_aes_ecb_decrypt((AES_KEY *)&aesctx->dec,
+    qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec,
                                    src, dst, length);
 }
 
Signature · 1 line
2.18.0
#7 lore raw

Re: [Qemu-devel] [PATCH 3/8] crypto: Remove useless casts

Quoted 16 lines · Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/typecast.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 crypto/cipher-builtin.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
crypto/cipher-builtin.c +0 -0
index d8c811fd33..7eff760f0a 100644

crypto/cipher-builtin.c static void qcrypto_cipher_aes_xts_encrypt(const void *ctx, · line 137

Quoted 6 lines
crypto/cipher-builtin.c +1 -1
@@ -133,7 +133,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx,
 {
     const QCryptoCipherBuiltinAESContext *aesctx = ctx;
 
-    qcrypto_cipher_aes_ecb_encrypt((AES_KEY *)&aesctx->enc,
+    qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc,
                                    src, dst, length);

qcrypto_cipher_aes_ecb_encrypt expects a 'AES_KEY *' parameter, but '&aesctx->enc, is a 'const AES_KEY *'. The cast is needed to discard the const-ness.

crypto/cipher-builtin.c static void qcrypto_cipher_aes_xts_decrypt(const void *ctx, · line 149

Quoted 7 lines
crypto/cipher-builtin.c +1 -1
@@ -145,7 +145,7 @@ static void qcrypto_cipher_aes_xts_decrypt(const void *ctx,
 {
     const QCryptoCipherBuiltinAESContext *aesctx = ctx;
 
-    qcrypto_cipher_aes_ecb_decrypt((AES_KEY *)&aesctx->dec,
+    qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec,
                                    src, dst, length);

Same here.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#8 lore raw

Re: [Qemu-devel] [PATCH 3/8] crypto: Remove useless casts

Quoted 20 lines · Daniel P. Berrangé
Quoted 19 lines · Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/typecast.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 crypto/cipher-builtin.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
crypto/cipher-builtin.c +0 -0
index d8c811fd33..7eff760f0a 100644
@@ -133,7 +133,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx,
 {
     const QCryptoCipherBuiltinAESContext *aesctx = ctx;
 
Quoted 7 lines

crypto/cipher-builtin.c static void qcrypto_cipher_aes_xts_encrypt(const void *ctx, · line 137

Quoted 3 lines
crypto/cipher-builtin.c +1 -1
-    qcrypto_cipher_aes_ecb_encrypt((AES_KEY *)&aesctx->enc,
+    qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc,
                                    src, dst, length);

qcrypto_cipher_aes_ecb_encrypt expects a 'AES_KEY *' parameter, but '&aesctx->enc, is a 'const AES_KEY *'. The cast is needed to discard the const-ness.

Oh I didn't notice. I'll see if I can patch typecast.cocci to avoid this noise.

Thanks!

Quoted 15 lines

crypto/cipher-builtin.c static void qcrypto_cipher_aes_xts_decrypt(const void *ctx, · line 149

Quoted 8 lines
crypto/cipher-builtin.c +1 -1
@@ -145,7 +145,7 @@ static void qcrypto_cipher_aes_xts_decrypt(const void *ctx,
 {
     const QCryptoCipherBuiltinAESContext *aesctx = ctx;
 
-    qcrypto_cipher_aes_ecb_decrypt((AES_KEY *)&aesctx->dec,
+    qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec,
                                    src, dst, length);

Same here.

Regards,
Daniel

#9 lore raw

PATCH 4/8 xen: Remove useless casts

In reply to Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/typecast.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 hw/xen/xen_pt_config_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/xen/xen_pt_config_init.c +1 -1
index aee31c62bb..55a83333f2 100644
@@ -543,7 +543,7 @@ static int xen_pt_exp_rom_bar_reg_write(XenPCIPassthroughState *s,
 {
     XenPTRegInfo *reg = cfg_entry->reg;
     XenPTRegion *base = NULL;
-    PCIDevice *d = (PCIDevice *)&s->dev;
+    PCIDevice *d = &s->dev;
     uint32_t writable_mask = 0;
     uint32_t throughable_mask = get_throughable_mask(s, reg, valid_mask);
     pcibus_t r_size = 0;
Signature · 7 lines
2.18.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 4/8
#10 lore raw

Re: [Qemu-devel] [PATCH 4/8] xen: Remove useless casts

Quoted 16 lines · Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/typecast.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 hw/xen/xen_pt_config_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/xen/xen_pt_config_init.c +0 -0
index aee31c62bb..55a83333f2 100644

hw/xen/xen_pt_config_init.c static int xen_pt_exp_rom_bar_reg_write(XenPCIPassthroughState *s, · line 549

Quoted 8 lines
hw/xen/xen_pt_config_init.c +1 -1
@@ -543,7 +543,7 @@ static int xen_pt_exp_rom_bar_reg_write(XenPCIPassthroughState *s,
 {
     XenPTRegInfo *reg = cfg_entry->reg;
     XenPTRegion *base = NULL;
-    PCIDevice *d = (PCIDevice *)&s->dev;
+    PCIDevice *d = &s->dev;
     uint32_t writable_mask = 0;
     uint32_t throughable_mask = get_throughable_mask(s, reg, valid_mask);
     pcibus_t r_size = 0;

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v1 4/8
#11 lore raw

Re: [Qemu-devel] [PATCH 4/8] xen: Remove useless casts

In reply to Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/typecast.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
Quoted 17 lines
---
 hw/xen/xen_pt_config_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/xen/xen_pt_config_init.c +1 -1
index aee31c62bb..55a83333f2 100644
@@ -543,7 +543,7 @@ static int xen_pt_exp_rom_bar_reg_write(XenPCIPassthroughState *s,
 {
     XenPTRegInfo *reg = cfg_entry->reg;
     XenPTRegion *base = NULL;
-    PCIDevice *d = (PCIDevice *)&s->dev;
+    PCIDevice *d = &s->dev;
     uint32_t writable_mask = 0;
     uint32_t throughable_mask = get_throughable_mask(s, reg, valid_mask);
     pcibus_t r_size = 0;
Signature · 6 lines
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#12 lore raw

Re: [Qemu-devel] [PATCH 4/8] xen: Remove useless casts

In reply to Philippe Mathieu-Daudé
Quoted 16 lines · Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/typecast.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 hw/xen/xen_pt_config_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/xen/xen_pt_config_init.c +0 -0
index aee31c62bb..55a83333f2 100644

hw/xen/xen_pt_config_init.c static int xen_pt_exp_rom_bar_reg_write(XenPCIPassthroughState *s, · line 546

Quoted 5 lines
hw/xen/xen_pt_config_init.c +1 -1
@@ -543,7 +543,7 @@ static int xen_pt_exp_rom_bar_reg_write(XenPCIPassthroughState *s,
 {
     XenPTRegInfo *reg = cfg_entry->reg;
     XenPTRegion *base = NULL;
-    PCIDevice *d = (PCIDevice *)&s->dev;
+    PCIDevice *d = &s->dev;

This line of code is odd even without the cast. XenPCIPassthroughState* is a QOM object (TYPE_XEN_PT_DEVICE) which is a subclass of TYPE_PCI_DEVICE, so the standard way to get the PCIDevice pointer for s would be
PCIDevice *d = PCI_DEVICE(s);

thanks
-- PMM

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#13 lore raw

Re: [Qemu-devel] [PATCH 4/8] xen: Remove useless casts

Quoted 12 lines · Peter Maydell
Quoted 11 lines · Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/typecast.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 hw/xen/xen_pt_config_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines

hw/xen/xen_pt_config_init.c static int xen_pt_exp_rom_bar_reg_write(XenPCIPassthroughState *s, · line 546

Quoted 10 lines
hw/xen/xen_pt_config_init.c +1 -1
index aee31c62bb..55a83333f2 100644
@@ -543,7 +543,7 @@ static int xen_pt_exp_rom_bar_reg_write(XenPCIPassthroughState *s,
 {
     XenPTRegInfo *reg = cfg_entry->reg;
     XenPTRegion *base = NULL;
-    PCIDevice *d = (PCIDevice *)&s->dev;
+    PCIDevice *d = &s->dev;

This line of code is odd even without the cast. XenPCIPassthroughState* is a QOM object (TYPE_XEN_PT_DEVICE) which is a subclass of TYPE_PCI_DEVICE, so the standard way to get the PCIDevice pointer for s would be
PCIDevice *d = PCI_DEVICE(s);

You have eagle eyes...

Thanks for your review :)

Phil.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#14 lore raw

PATCH 5/8 tests/bios-tables-test: Remove useless casts

In reply to Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/typecast.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 tests/bios-tables-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/bios-tables-test.c +1 -1
index 4e24930c4b..c1ad1b3470 100644
@@ -319,7 +319,7 @@ static bool load_asl(GArray *sdts, AcpiSdtTable *sdt)
     ret = g_spawn_command_line_sync(command_line->str, &out, &out_err, NULL, &error);
     g_assert_no_error(error);
     if (ret) {
-        ret = g_file_get_contents(sdt->asl_file, (gchar **)&sdt->asl,
+        ret = g_file_get_contents(sdt->asl_file, &sdt->asl,
                                   &sdt->asl_len, &error);
         g_assert(ret);
         g_assert_no_error(error);
Signature · 1 line
2.18.0
Reviewed-by on v1 5/8
#15 lore raw

Re: [Qemu-devel] [PATCH 5/8] tests/bios-tables-test: Remove useless casts

Quoted 16 lines · Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/typecast.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 tests/bios-tables-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/bios-tables-test.c +0 -0
index 4e24930c4b..c1ad1b3470 100644

tests/bios-tables-test.c static bool load_asl(GArray *sdts, AcpiSdtTable *sdt) · line 325

Quoted 8 lines
tests/bios-tables-test.c +1 -1
@@ -319,7 +319,7 @@ static bool load_asl(GArray *sdts, AcpiSdtTable *sdt)
     ret = g_spawn_command_line_sync(command_line->str, &out, &out_err, NULL, &error);
     g_assert_no_error(error);
     if (ret) {
-        ret = g_file_get_contents(sdt->asl_file, (gchar **)&sdt->asl,
+        ret = g_file_get_contents(sdt->asl_file, &sdt->asl,
                                   &sdt->asl_len, &error);
         g_assert(ret);
         g_assert_no_error(error);
#16 lore raw

PATCH 6/8 ui/vnc: Remove useless parenthesis around DIV_ROUND_UP macro

In reply to Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/round.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 ui/vnc-enc-tight.c | 2 +-
 ui/vnc.c           | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
ui/vnc-enc-tight.c +1 -1
index f38aceb4da..0b4a5ac71f 100644
@@ -979,7 +979,7 @@ static int send_mono_rect(VncState *vs, int x, int y,
     }
 #endif
 
-    bytes = (DIV_ROUND_UP(w, 8)) * h;
+    bytes = DIV_ROUND_UP(w, 8) * h;
 
     vnc_write_u8(vs, (stream | VNC_TIGHT_EXPLICIT_FILTER) << 4);
     vnc_write_u8(vs, VNC_TIGHT_FILTER_PALETTE);
ui/vnc.c +2 -1
index 359693238b..3361432a51 100644
@@ -2967,7 +2967,8 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
             PIXMAN_FORMAT_BPP(pixman_image_get_format(vd->guest.fb));
         guest_row0 = (uint8_t *)pixman_image_get_data(vd->guest.fb);
         guest_stride = pixman_image_get_stride(vd->guest.fb);
-        guest_ll = pixman_image_get_width(vd->guest.fb) * (DIV_ROUND_UP(guest_bpp, 8));
+        guest_ll = pixman_image_get_width(vd->guest.fb)
+                   * DIV_ROUND_UP(guest_bpp, 8);
     }
     line_bytes = MIN(server_stride, guest_ll);
 
Signature · 1 line
2.18.0
Reviewed-by on v1 6/8
#17 lore raw

Re: [Qemu-devel] [PATCH 6/8] ui/vnc: Remove useless parenthesis around DIV_ROUND_UP macro

Quoted 30 lines · Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/round.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 ui/vnc-enc-tight.c | 2 +-
 ui/vnc.c           | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
ui/vnc-enc-tight.c +1 -1
index f38aceb4da..0b4a5ac71f 100644
@@ -979,7 +979,7 @@ static int send_mono_rect(VncState *vs, int x, int y,
     }
 #endif
 
-    bytes = (DIV_ROUND_UP(w, 8)) * h;
+    bytes = DIV_ROUND_UP(w, 8) * h;
 
     vnc_write_u8(vs, (stream | VNC_TIGHT_EXPLICIT_FILTER) << 4);
     vnc_write_u8(vs, VNC_TIGHT_FILTER_PALETTE);
ui/vnc.c +0 -0
index 359693238b..3361432a51 100644

ui/vnc.c static int vnc_refresh_server_surface(VncDisplay *vd) · line 2973

Quoted 8 lines
ui/vnc.c +2 -1
@@ -2967,7 +2967,8 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
             PIXMAN_FORMAT_BPP(pixman_image_get_format(vd->guest.fb));
         guest_row0 = (uint8_t *)pixman_image_get_data(vd->guest.fb);
         guest_stride = pixman_image_get_stride(vd->guest.fb);
-        guest_ll = pixman_image_get_width(vd->guest.fb) * (DIV_ROUND_UP(guest_bpp, 8));
+        guest_ll = pixman_image_get_width(vd->guest.fb)
+                   * DIV_ROUND_UP(guest_bpp, 8);
     }
     line_bytes = MIN(server_stride, guest_ll);
#19 lore raw

PATCH 7/8 hw/pci-host: Remove useless parenthesis around DIV_ROUND_UP macro

In reply to Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/round.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 hw/pci-host/piix.c | 2 +-
 hw/pci-host/q35.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
hw/pci-host/piix.c +1 -1
index 0e608347c1..317c0feca6 100644
@@ -144,7 +144,7 @@ static void i440fx_update_memory_mappings(PCII440FXState *d)
     memory_region_transaction_begin();
     for (i = 0; i < 13; i++) {
         pam_update(&d->pam_regions[i], i,
-                   pd->config[I440FX_PAM + (DIV_ROUND_UP(i, 2))]);
+                   pd->config[I440FX_PAM + DIV_ROUND_UP(i, 2)]);
     }
     memory_region_set_enabled(&d->smram_region,
                               !(pd->config[I440FX_SMRAM] & SMRAM_D_OPEN));
hw/pci-host/q35.c +1 -1
index 02f9576588..b3a5b3036d 100644
@@ -352,7 +352,7 @@ static void mch_update_pam(MCHPCIState *mch)
     memory_region_transaction_begin();
     for (i = 0; i < 13; i++) {
         pam_update(&mch->pam_regions[i], i,
-                   pd->config[MCH_HOST_BRIDGE_PAM0 + (DIV_ROUND_UP(i, 2))]);
+                   pd->config[MCH_HOST_BRIDGE_PAM0 + DIV_ROUND_UP(i, 2)]);
     }
     memory_region_transaction_commit();
 }
Signature · 1 line
2.18.0
Reviewed-by on v1 7/8
#20 lore raw

Re: [Qemu-devel] [PATCH 7/8] hw/pci-host: Remove useless parenthesis around DIV_ROUND_UP macro

Quoted 30 lines · Philippe Mathieu-Daudé

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/round.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place
---
 hw/pci-host/piix.c | 2 +-
 hw/pci-host/q35.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
hw/pci-host/piix.c +1 -1
index 0e608347c1..317c0feca6 100644
@@ -144,7 +144,7 @@ static void i440fx_update_memory_mappings(PCII440FXState *d)
     memory_region_transaction_begin();
     for (i = 0; i < 13; i++) {
         pam_update(&d->pam_regions[i], i,
-                   pd->config[I440FX_PAM + (DIV_ROUND_UP(i, 2))]);
+                   pd->config[I440FX_PAM + DIV_ROUND_UP(i, 2)]);
     }
     memory_region_set_enabled(&d->smram_region,
                               !(pd->config[I440FX_SMRAM] & SMRAM_D_OPEN));
hw/pci-host/q35.c +0 -0
index 02f9576588..b3a5b3036d 100644

hw/pci-host/q35.c static void mch_update_pam(MCHPCIState *mch) · line 358

Quoted 8 lines
hw/pci-host/q35.c +1 -1
@@ -352,7 +352,7 @@ static void mch_update_pam(MCHPCIState *mch)
     memory_region_transaction_begin();
     for (i = 0; i < 13; i++) {
         pam_update(&mch->pam_regions[i], i,
-                   pd->config[MCH_HOST_BRIDGE_PAM0 + (DIV_ROUND_UP(i, 2))]);
+                   pd->config[MCH_HOST_BRIDGE_PAM0 + DIV_ROUND_UP(i, 2)]);
     }
     memory_region_transaction_commit();
 }
#21 lore raw

PATCH 8/8 hw/intc/gicv3: Remove useless parenthesis around DIV_ROUND_UP macro

In reply to Philippe Mathieu-Daudé
---
 include/hw/intc/arm_gicv3_common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/intc/arm_gicv3_common.h +1 -1
index b798486ecf..31ec9a1ae4 100644
@@ -62,7 +62,7 @@
  * avoids bugs where we forget to subtract GIC_INTERNAL from an
  * interrupt number.
  */
-#define GICV3_BMP_SIZE (DIV_ROUND_UP(GICV3_MAXIRQ, 32))
+#define GICV3_BMP_SIZE DIV_ROUND_UP(GICV3_MAXIRQ, 32)
 
 #define GIC_DECLARE_BITMAP(name) \
     uint32_t name[GICV3_BMP_SIZE]
Signature · 1 line
2.18.0
Acked-by on the v1 series
#24 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 2 lines · Philippe Mathieu-Daudé

Nothing exciting here, patches created mechanically (common after soft freeze).

Quoted 10 lines

Philippe Mathieu-Daudé (8):
qobject: Catch another straggler for use of qdict_put_str()
error: Remove NULL checks on error_propagate() calls
crypto: Remove useless casts
xen: Remove useless casts
tests/bios-tables-test: Remove useless casts
ui/vnc: Remove useless parenthesis around DIV_ROUND_UP macro hw/pci-host: Remove useless parenthesis around DIV_ROUND_UP macro hw/intc/gicv3: Remove useless parenthesis around DIV_ROUND_UP macro

Quoted 14 lines
 include/hw/intc/arm_gicv3_common.h | 2 +-
 crypto/cipher-builtin.c            | 4 ++--
 hw/pci-host/piix.c                 | 2 +-
 hw/pci-host/q35.c                  | 2 +-
 hw/s390x/virtio-ccw.c              | 4 +---
 hw/xen/xen_pt_config_init.c        | 2 +-
 qobject/block-qdict.c              | 2 +-
 tests/bios-tables-test.c           | 2 +-
 ui/vnc-enc-tight.c                 | 2 +-
 ui/vnc.c                           | 3 ++-
 10 files changed, 12 insertions(+), 13 deletions(-)
Signature · 1 line
2.18.0

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on the v1 series
#25 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 2 lines · Philippe Mathieu-Daudé

Nothing exciting here, patches created mechanically (common after soft freeze).

Quoted 24 lines

Philippe Mathieu-Daudé (8):
qobject: Catch another straggler for use of qdict_put_str()
error: Remove NULL checks on error_propagate() calls
crypto: Remove useless casts
xen: Remove useless casts
tests/bios-tables-test: Remove useless casts
ui/vnc: Remove useless parenthesis around DIV_ROUND_UP macro hw/pci-host: Remove useless parenthesis around DIV_ROUND_UP macro hw/intc/gicv3: Remove useless parenthesis around DIV_ROUND_UP macro

 include/hw/intc/arm_gicv3_common.h | 2 +-
 crypto/cipher-builtin.c            | 4 ++--
 hw/pci-host/piix.c                 | 2 +-
 hw/pci-host/q35.c                  | 2 +-
 hw/s390x/virtio-ccw.c              | 4 +---
 hw/xen/xen_pt_config_init.c        | 2 +-
 qobject/block-qdict.c              | 2 +-
 tests/bios-tables-test.c           | 2 +-
 ui/vnc-enc-tight.c                 | 2 +-
 ui/vnc.c                           | 3 ++-
 10 files changed, 12 insertions(+), 13 deletions(-)
Signature · 1 line
2.18.0