Skip to contentSkip to conversation

Trivial patches for 2013-06-22

GIT PULL Michael Tokarev 1 participant 18 messages Jun 22, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

Hello. There are quite a few trivial patches this week again, now they're really trivial, nothing facy like previous week.

I'm not including the chardev+socket fixes from Gerd for now, these are really nice but I had a few questions there. Hopefully next week.

Please consider pulling.

Thanks,

/mjt

The following changes since commit 576156ffed72ab4feb0b752979db86ff8759a2a1:

Merge remote-tracking branch 'bonzini/iommu-for-anthony' into staging (2013-06-20 16:53:39 -0500)

are available in the git repository at:

git://git.corpit.ru/qemu.git trivial-patches

for you to fetch changes up to 464e3671f9d5c206fa9e2646c81f21ceef7cfb7d:

configure: Add signed*signed check to [u]int128_t test (2013-06-21 22:54:24 +0400)

----------------------------------------------------------------
Amos Kong (1):
qapi: lack of two commas in dict

Andreas Färber (1):
configure: Fix "ERROR: ERROR: " for missing/incompatible DTC

Anthony PERARD (1):
qxl: Fix QXLRam initialisation.

Markus Armbruster (1):
acl: acl_add can't insert before last list element, fix

Michael Tokarev (3):
vl: reformat SDL ifdeffery a bit
qemu-options: trivial fix for -mon args help
vnc: use booleans for vnc_connect, vnc_listen_read and vnc_display_add_client

Peter Crosthwaite (1):
block/nand: Formatting sweep

Peter Maydell (2):
Makefile: pass include directives to dtc via CPPFLAGS, not CFLAGS
configure: Add signed*signed check to [u]int128_t test

Stefan Weil (5):
qemu-img: Add missing GCC_FMT_ATTR
kvm: Fix potential resource leak (missing fclose)
savevm: Fix potential memory leak
libcacard: Fix cppcheck warning and remove unneeded code
audio: Replace static functions in header file by macros, remove GCC_ATTR

liguang (2):
qemu-char: use bool in qemu_chr_open_socket and simplify code a bit
sd: pass bool parameter for sd_init

 Makefile                   |    5 +++--
 audio/audio_int.h          |   31 +++----------------------------
 configure                  |    3 ++-
 hw/block/nand.c            |   33 ++++++++++++++++++---------------
 hw/display/qxl.c           |    1 +
 hw/i386/kvm/pci-assign.c   |    1 +
 hw/sd/milkymist-memcard.c  |    2 +-
 hw/sd/omap_mmc.c           |    4 ++--
 hw/sd/pl181.c              |    2 +-
 hw/sd/pxa2xx_mmci.c        |    2 +-
 hw/sd/sdhci.c              |    2 +-
 hw/sd/ssi-sd.c             |    2 +-
 include/qemu/compiler.h    |    3 ---
 include/ui/console.h       |    2 +-
 libcacard/vcard_emul_nss.c |   22 ++++++----------------
 qapi-schema.json           |    4 ++--
 qemu-char.c                |   19 ++++++-------------
 qemu-img.c                 |    2 +-
 qemu-options.hx            |    4 ++--
 savevm.c                   |    3 ++-
 ui/vnc.c                   |   15 ++++++++-------
 util/acl.c                 |    4 ++--
 vl.c                       |    3 +--
 23 files changed, 66 insertions(+), 103 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 01/17] vl: reformat SDL ifdeffery a bit

This reformats #ifdef..#endif and case statement a bit, to make it a bit shorter and matching other cases like that (no code changes).

---
 vl.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
vl.c +1 -2
index 767e020..0a8f056 100644
@@ -3472,12 +3472,11 @@ int main(int argc, char **argv, char **envp)
             case QEMU_OPTION_no_quit:
                 no_quit = 1;
                 break;
-#ifdef CONFIG_SDL
             case QEMU_OPTION_sdl:
+#ifdef CONFIG_SDL
                 display_type = DT_SDL;
                 break;
 #else
-            case QEMU_OPTION_sdl:
                 fprintf(stderr, "SDL support is disabled\n");
                 exit(1);
 #endif
Signature · 1 line
1.7.10.4
#2 lore raw

[Qemu-devel] [PULL 02/17] qemu-options: trivial fix for -mon args help

In reply to Michael Tokarev

It is the (implied sub)option name which is optional, not the value of that (sub)option, make it so in the help output. (Introduced by commit 22a0e04b9bb)

---
 qemu-options.hx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
qemu-options.hx +2 -2
index 8355f9b..688040e 100644
@@ -2539,9 +2539,9 @@ Like -monitor but opens in 'control' mode.
 ETEXI
 
 DEF("mon", HAS_ARG, QEMU_OPTION_mon, \
-    "-mon chardev=[name][,mode=readline|control][,default]\n", QEMU_ARCH_ALL)
+    "-mon [chardev=]name[,mode=readline|control][,default]\n", QEMU_ARCH_ALL)
 STEXI
-@item -mon chardev=[name][,mode=readline|control][,default]
+@item -mon [chardev=]name[,mode=readline|control][,default]
 @findex -mon
 Setup monitor on chardev @var{name}.
 ETEXI
Signature · 1 line
1.7.10.4
#3 lore raw

[Qemu-devel] [PULL 03/17] qemu-img: Add missing GCC_FMT_ATTR

In reply to Michael Tokarev

From: Stefan Weil <[email protected]>

---
 qemu-img.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qemu-img.c +1 -1
index 809b4f1..f8c97d3 100644
@@ -128,7 +128,7 @@ static void help(void)
     exit(1);
 }
 
-static int qprintf(bool quiet, const char *fmt, ...)
+static int GCC_FMT_ATTR(2, 3) qprintf(bool quiet, const char *fmt, ...)
 {
     int ret = 0;
     if (!quiet) {
Signature · 1 line
1.7.10.4
#4 lore raw

[Qemu-devel] [PULL 04/17] kvm: Fix potential resource leak (missing fclose)

In reply to Michael Tokarev

From: Stefan Weil <[email protected]>

This leak was detected by cppcheck.

---
 hw/i386/kvm/pci-assign.c |    1 +
 1 file changed, 1 insertion(+)
hw/i386/kvm/pci-assign.c +1 -0
index ff85590..1fb7ad4 100644
@@ -548,6 +548,7 @@ static int get_real_id(const char *devpath, const char *idname, uint16_t *val)
     if (fscanf(f, "%li\n", &id) == 1) {
         *val = id;
     } else {
+        fclose(f);
         return -1;
     }
     fclose(f);
Signature · 1 line
1.7.10.4
#5 lore raw

[Qemu-devel] [PULL 05/17] savevm: Fix potential memory leak

In reply to Michael Tokarev

From: Stefan Weil <[email protected]>

The leak was reported by cppcheck. Fix it by moving the g_malloc0 after the argument validity check.

---
 savevm.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
savevm.c +2 -1
index ff5ece6..48cc2a9 100644
@@ -479,7 +479,7 @@ static const QEMUFileOps socket_write_ops = {
 
 QEMUFile *qemu_fopen_socket(int fd, const char *mode)
 {
-    QEMUFileSocket *s = g_malloc0(sizeof(QEMUFileSocket));
+    QEMUFileSocket *s;
 
     if (mode == NULL ||
         (mode[0] != 'r' && mode[0] != 'w') ||
@@ -488,6 +488,7 @@ QEMUFile *qemu_fopen_socket(int fd, const char *mode)
         return NULL;
     }
 
+    s = g_malloc0(sizeof(QEMUFileSocket));
     s->fd = fd;
     if (mode[0] == 'w') {
         qemu_set_block(s->fd);
Signature · 1 line
1.7.10.4
#6 lore raw

[Qemu-devel] [PULL 12/17] vnc: use booleans for vnc_connect, vnc_listen_read and vnc_display_add_client

In reply to Michael Tokarev

Some arguments to these functions are booleans - either by declaration, or by actual usage, but sometimes value of 0 or 1 is passed for a bool, and sometimes it is declared as int but a bool value, or true/false, is passed to it instead. Clean it up a bit.

---
 include/ui/console.h |    2 +-
 ui/vnc.c             |   15 ++++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)
include/ui/console.h +1 -1
index f1d79f9..98edf41 100644
@@ -314,7 +314,7 @@ void cocoa_display_init(DisplayState *ds, int full_screen);
 /* vnc.c */
 void vnc_display_init(DisplayState *ds);
 void vnc_display_open(DisplayState *ds, const char *display, Error **errp);
-void vnc_display_add_client(DisplayState *ds, int csock, int skipauth);
+void vnc_display_add_client(DisplayState *ds, int csock, bool skipauth);
 char *vnc_display_local_addr(DisplayState *ds);
 #ifdef CONFIG_VNC
 int vnc_display_password(DisplayState *ds, const char *password);
ui/vnc.c +8 -7
index dfc7459..5601cc3 100644
@@ -2771,7 +2771,8 @@ static void vnc_refresh(DisplayChangeListener *dcl)
     }
 }
 
-static void vnc_connect(VncDisplay *vd, int csock, int skipauth, bool websocket)
+static void vnc_connect(VncDisplay *vd, int csock,
+                        bool skipauth, bool websocket)
 {
     VncState *vs = g_malloc0(sizeof(VncState));
     int i;
@@ -2883,19 +2884,19 @@ static void vnc_listen_read(void *opaque, bool websocket)
     }
 
     if (csock != -1) {
-        vnc_connect(vs, csock, 0, websocket);
+        vnc_connect(vs, csock, false, websocket);
     }
 }
 
 static void vnc_listen_regular_read(void *opaque)
 {
-    vnc_listen_read(opaque, 0);
+    vnc_listen_read(opaque, false);
 }
 
 #ifdef CONFIG_VNC_WS
 static void vnc_listen_websocket_read(void *opaque)
 {
-    vnc_listen_read(opaque, 1);
+    vnc_listen_read(opaque, true);
 }
 #endif /* CONFIG_VNC_WS */
 
@@ -3283,7 +3284,7 @@ void vnc_display_open(DisplayState *ds, const char *display, Error **errp)
         if (csock < 0) {
             goto fail;
         }
-        vnc_connect(vs, csock, 0, 0);
+        vnc_connect(vs, csock, false, false);
     } else {
         /* listen for connects */
         char *dpy;
@@ -3341,9 +3342,9 @@ fail:
 #endif /* CONFIG_VNC_WS */
 }
 
-void vnc_display_add_client(DisplayState *ds, int csock, int skipauth)
+void vnc_display_add_client(DisplayState *ds, int csock, bool skipauth)
 {
     VncDisplay *vs = vnc_display;
 
-    vnc_connect(vs, csock, skipauth, 0);
+    vnc_connect(vs, csock, skipauth, false);
 }
Signature · 1 line
1.7.10.4
#7 lore raw

[Qemu-devel] [PULL 16/17] Makefile: pass include directives to dtc via CPPFLAGS, not CFLAGS

In reply to Michael Tokarev

From: Peter Maydell <[email protected]>

The dtc submodule's makefile expects -I include directives to be in CPPFLAGS, not CFLAGS. Getting this wrong meant that the include directive would not be applied when generating the dependency .d files. This in turn meant that we couldn't build libfdt when doing an out of tree build with clang. (gcc's dependency output is slightly different from clang in this situation so it happened to work.)

---
 Makefile |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Makefile +3 -2
index 3cfa7d0..c06bfab 100644
@@ -146,10 +146,11 @@ $(SRC_PATH)/pixman/configure:
 	(cd $(SRC_PATH)/pixman; autoreconf -v --install)
 
 DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
-DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS) -I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
+DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
+DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
 
 subdir-dtc:dtc/libfdt dtc/tests
-	$(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt/libfdt.a,)
+	$(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS="$(DTC_CPPFLAGS)" CFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt/libfdt.a,)
 
 dtc/%:
 	mkdir -p $@
Signature · 1 line
1.7.10.4
#8 lore raw

[Qemu-devel] [PULL 17/17] configure: Add signed*signed check to [u]int128_t test

In reply to Michael Tokarev

From: Peter Maydell <[email protected]>

clang 3.3 with -fsanitize=undefined will fail to link code containing an int128_t * int128_t multiply (http://llvm.org/bugs/show_bug.cgi?id=16404)
so add this to our configure test for whether [u]int128_t are usable.

---
 configure |    1 +
 1 file changed, 1 insertion(+)
configure +1 -0
index bb126e8..0e0adde 100755
@@ -3329,6 +3329,7 @@ __uint128_t b;
 int main (void) {
   a = a + b;
   b = a * b;
+  a = a * a;
   return 0;
 }
 EOF
Signature · 1 line
1.7.10.4
#9 lore raw

[Qemu-devel] [PULL 13/17] qemu-char: use bool in qemu_chr_open_socket and simplify code a bit

In reply to Michael Tokarev

From: liguang <[email protected]>

Local variables is_* should be bool by usage.
While at it, simplify the logic/code a bit.

---
 qemu-char.c |   19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)
qemu-char.c +6 -13
index 2c3cfe6..a030e6b 100644
@@ -2679,19 +2679,12 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts *opts)
     CharDriverState *chr = NULL;
     Error *local_err = NULL;
     int fd = -1;
-    int is_listen;
-    int is_waitconnect;
-    int do_nodelay;
-    int is_unix;
-    int is_telnet;
-
-    is_listen      = qemu_opt_get_bool(opts, "server", 0);
-    is_waitconnect = qemu_opt_get_bool(opts, "wait", 1);
-    is_telnet      = qemu_opt_get_bool(opts, "telnet", 0);
-    do_nodelay     = !qemu_opt_get_bool(opts, "delay", 1);
-    is_unix        = qemu_opt_get(opts, "path") != NULL;
-    if (!is_listen)
-        is_waitconnect = 0;
+
+    bool is_listen      = qemu_opt_get_bool(opts, "server", false);
+    bool is_waitconnect = is_listen && qemu_opt_get_bool(opts, "wait", true);
+    bool is_telnet      = qemu_opt_get_bool(opts, "telnet", false);
+    bool do_nodelay     = !qemu_opt_get_bool(opts, "delay", true);
+    bool is_unix        = qemu_opt_get(opts, "path") != NULL;
 
     if (is_unix) {
         if (is_listen) {
Signature · 1 line
1.7.10.4
#10 lore raw

[Qemu-devel] [PULL 08/17] configure: Fix "ERROR: ERROR: " for missing/incompatible DTC

In reply to Michael Tokarev

From: Andreas Färber <[email protected]>

error_exit already prepends "ERROR: ", so no need to print it manually.

---
 configure |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
index ad32f87..bb126e8 100755
@@ -2529,7 +2529,7 @@ EOF
     fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
   elif test "$fdt" = "yes" ; then
     # have neither and want - prompt for system/submodule install
-    error_exit "ERROR: DTC not present. Your options:" \
+    error_exit "DTC not present. Your options:" \
         "  (1) Preferred: Install the DTC devel package" \
         "  (2) Fetch the DTC submodule, using:" \
         "      git submodule update --init dtc"
Signature · 1 line
1.7.10.4
#11 lore raw

[Qemu-devel] [PULL 07/17] audio: Replace static functions in header file by macros, remove GCC_ATTR

In reply to Michael Tokarev

From: Stefan Weil <[email protected]>

Using macros instead of static functions for dolog and for ldebug simplifies the code and can also reduce the total code size.

GCC_ATTR was only used in audio_int.h, so it is now unused and the definition can be removed from compiler.h.

---
 audio/audio_int.h       |   31 +++----------------------------
 include/qemu/compiler.h |    3 ---
 2 files changed, 3 insertions(+), 31 deletions(-)
audio/audio_int.h +3 -28
index b9b0676..fd019a0 100644
@@ -243,38 +243,13 @@ static inline int audio_ring_dist (int dst, int src, int len)
     return (dst >= src) ? (dst - src) : (len - src + dst);
 }
 
-static void GCC_ATTR dolog (const char *fmt, ...)
-{
-    va_list ap;
-
-    va_start (ap, fmt);
-    AUD_vlog (AUDIO_CAP, fmt, ap);
-    va_end (ap);
-}
+#define dolog(fmt, ...) AUD_log(AUDIO_CAP, fmt, ## __VA_ARGS__)
 
 #ifdef DEBUG
-static void GCC_ATTR ldebug (const char *fmt, ...)
-{
-    va_list ap;
-
-    va_start (ap, fmt);
-    AUD_vlog (AUDIO_CAP, fmt, ap);
-    va_end (ap);
-}
+#define ldebug(fmt, ...) AUD_log(AUDIO_CAP, fmt, ## __VA_ARGS__)
 #else
-#if defined NDEBUG && defined __GNUC__
-#define ldebug(...)
-#elif defined NDEBUG && defined _MSC_VER
-#define ldebug __noop
-#else
-static void GCC_ATTR ldebug (const char *fmt, ...)
-{
-    (void) fmt;
-}
+#define ldebug(fmt, ...) (void)0
 #endif
-#endif
-
-#undef GCC_ATTR
 
 #define AUDIO_STRINGIFY_(n) #n
 #define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n)
include/qemu/compiler.h +0 -3
index 6175c24..155b358 100644
@@ -38,11 +38,9 @@
 #if defined __GNUC__
 # if !QEMU_GNUC_PREREQ(4, 4)
    /* gcc versions before 4.4.x don't support gnu_printf, so use printf. */
-#  define GCC_ATTR __attribute__((__unused__, format(printf, 1, 2)))
 #  define GCC_FMT_ATTR(n, m) __attribute__((format(printf, n, m)))
 # else
    /* Use gnu_printf when supported (qemu uses standard format strings). */
-#  define GCC_ATTR __attribute__((__unused__, format(gnu_printf, 1, 2)))
 #  define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m)))
 #  if defined(_WIN32)
     /* Map __printf__ to __gnu_printf__ because we want standard format strings
@@ -51,7 +49,6 @@
 #  endif
 # endif
 #else
-#define GCC_ATTR /**/
 #define GCC_FMT_ATTR(n, m)
 #endif
 
Signature · 1 line
1.7.10.4
#12 lore raw

[Qemu-devel] [PULL 09/17] acl: acl_add can't insert before last list element, fix

In reply to Michael Tokarev

From: Markus Armbruster <[email protected]>

Watch this:

    $ upstream-qemu -nodefaults -S -vnc :0,acl,sasl -monitor stdio
    QEMU 1.5.50 monitor - type 'help' for more information
    (qemu) acl_add vnc.username drei allow
    acl: added rule at position 1
    (qemu) acl_show vnc.username
    policy: deny
    1: allow drei
    (qemu) acl_add vnc.username zwei allow 1
    acl: added rule at position 2
    (qemu) acl_show vnc.username
    policy: deny
    1: allow drei
    2: allow zwei
    (qemu) acl_add vnc.username eins allow 1
    acl: added rule at position 1
    (qemu) acl_show vnc.username
    policy: deny
    1: allow eins
    2: allow drei
    3: allow zwei

The second acl_add inserts at position 2 instead of 1.

Root cause is an off-by-one in qemu_acl_insert(): when index == acl->nentries, it appends instead of inserting before the last list element.

---
 util/acl.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
util/acl.c +2 -2
index a7f33ff..938b7ae 100644
@@ -138,9 +138,9 @@ int qemu_acl_insert(qemu_acl *acl,
 
     if (index <= 0)
         return -1;
-    if (index >= acl->nentries)
+    if (index > acl->nentries) {
         return qemu_acl_append(acl, deny, match);
-
+    }
 
     entry = g_malloc(sizeof(*entry));
     entry->match = g_strdup(match);
Signature · 1 line
1.7.10.4
#13 lore raw

[Qemu-devel] [PULL 15/17] qapi: lack of two commas in dict

In reply to Michael Tokarev

From: Amos Kong <[email protected]>

---
 qapi-schema.json |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
qapi-schema.json +2 -2
index a80ee40..6cc07c2 100644
@@ -391,7 +391,7 @@
 #
 # Since: 1.4
 ##
-{ 'enum': 'DataFormat'
+{ 'enum': 'DataFormat',
   'data': [ 'utf8', 'base64' ] }
 
 ##
@@ -1595,7 +1595,7 @@
 #
 # Since: 1.1
 ##
-{ 'enum': 'NewImageMode'
+{ 'enum': 'NewImageMode',
   'data': [ 'existing', 'absolute-paths' ] }
 
 ##
Signature · 1 line
1.7.10.4
#14 lore raw

[Qemu-devel] [PULL 06/17] libcacard: Fix cppcheck warning and remove unneeded code

In reply to Michael Tokarev

From: Stefan Weil <[email protected]>

The local function vcard_emul_alloc_arrays always returned PR_TRUE. Therefore cppcheck complained about code which handled the non-existent PR_FALSE case.

Remove the function's return value and the dead code.

---
 libcacard/vcard_emul_nss.c |   22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
libcacard/vcard_emul_nss.c +6 -16
index 1a3e568..fb429b1 100644
@@ -90,17 +90,13 @@ static int nss_emul_init;
 /*
  * allocate the set of arrays for certs, cert_len, key
  */
-static PRBool
+static void
 vcard_emul_alloc_arrays(unsigned char ***certsp, int **cert_lenp,
                         VCardKey ***keysp, int cert_count)
 {
-    *certsp = NULL;
-    *cert_lenp = NULL;
-    *keysp = NULL;
     *certsp = (unsigned char **)g_malloc(sizeof(unsigned char *)*cert_count);
     *cert_lenp = (int *)g_malloc(sizeof(int)*cert_count);
     *keysp = (VCardKey **)g_malloc(sizeof(VCardKey *)*cert_count);
-    return PR_TRUE;
 }
 
 /*
@@ -601,7 +597,6 @@ vcard_emul_mirror_card(VReader *vreader)
     int *cert_len;
     VCardKey **keys;
     PK11SlotInfo *slot;
-    PRBool ret;
     VCard *card;
 
     slot = vcard_emul_reader_get_slot(vreader);
@@ -627,10 +622,7 @@ vcard_emul_mirror_card(VReader *vreader)
     }
 
     /* allocate the arrays */
-    ret = vcard_emul_alloc_arrays(&certs, &cert_len, &keys, cert_count);
-    if (ret == PR_FALSE) {
-        return NULL;
-    }
+    vcard_emul_alloc_arrays(&certs, &cert_len, &keys, cert_count);
 
     /* fill in the arrays */
     cert_count = 0;
@@ -878,7 +870,7 @@ VCardEmulError
 vcard_emul_init(const VCardEmulOptions *options)
 {
     SECStatus rv;
-    PRBool ret, has_readers = PR_FALSE;
+    PRBool has_readers = PR_FALSE;
     VReader *vreader;
     VReaderEmul *vreader_emul;
     SECMODListLock *module_lock;
@@ -944,11 +936,9 @@ vcard_emul_init(const VCardEmulOptions *options)
         vreader_add_reader(vreader);
         cert_count = options->vreader[i].cert_count;
 
-        ret = vcard_emul_alloc_arrays(&certs, &cert_len, &keys,
-                                      options->vreader[i].cert_count);
-        if (ret == PR_FALSE) {
-            continue;
-        }
+        vcard_emul_alloc_arrays(&certs, &cert_len, &keys,
+                                options->vreader[i].cert_count);
+
         cert_count = 0;
         for (j = 0; j < options->vreader[i].cert_count; j++) {
             /* we should have a better way of identifying certs than by
Signature · 1 line
1.7.10.4
#15 lore raw

[Qemu-devel] [PULL 10/17] qxl: Fix QXLRam initialisation.

In reply to Michael Tokarev

From: Anthony PERARD <[email protected]>

The qxl driver expect NULL for QXLRam.memory_configs, but this is never initialized.

If memory is set to 0xc2c2.., it leads to a spice-critical error when trying to start qxl.

---
 hw/display/qxl.c |    1 +
 1 file changed, 1 insertion(+)
hw/display/qxl.c +1 -0
index c475cb1..937a402 100644
@@ -387,6 +387,7 @@ static void init_qxl_ram(PCIQXLDevice *d)
     d->ram->int_pending = cpu_to_le32(0);
     d->ram->int_mask    = cpu_to_le32(0);
     d->ram->update_surface = 0;
+    d->ram->monitors_config = 0;
     SPICE_RING_INIT(&d->ram->cmd_ring);
     SPICE_RING_INIT(&d->ram->cursor_ring);
     SPICE_RING_INIT(&d->ram->release_ring);
Signature · 1 line
1.7.10.4
#16 lore raw

[Qemu-devel] [PULL 11/17] block/nand: Formatting sweep

In reply to Michael Tokarev

From: Peter Crosthwaite <[email protected]>

Make this code closer to passing checkpatch. Mostly missing braces, but a few rogue tabs in there as well.

---
 hw/block/nand.c |   33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)
hw/block/nand.c +18 -15
index 087ca14..43401a0 100644
@@ -298,10 +298,8 @@ static void nand_command(NANDFlashState *s)
 
     case NAND_CMD_BLOCKERASE2:
         s->addr &= (1ull << s->addrlen * 8) - 1;
-        if (nand_flash_ids[s->chip_id].options & NAND_SAMSUNG_LP)
-            s->addr <<= 16;
-        else
-            s->addr <<= 8;
+        s->addr <<= nand_flash_ids[s->chip_id].options & NAND_SAMSUNG_LP ?
+                                                                    16 : 8;
 
         if (s->wp) {
             s->blk_erase(s);
@@ -464,10 +462,11 @@ void nand_setpins(DeviceState *dev, uint8_t cle, uint8_t ale,
     s->ce = ce;
     s->wp = wp;
     s->gnd = gnd;
-    if (wp)
+    if (wp) {
         s->status |= NAND_IOSTATUS_UNPROTCT;
-    else
+    } else {
         s->status &= ~NAND_IOSTATUS_UNPROTCT;
+    }
 }
 
 void nand_getpins(DeviceState *dev, int *rb)
@@ -489,13 +488,12 @@ void nand_setio(DeviceState *dev, uint32_t value)
                 return;
             }
         }
-        if (value == NAND_CMD_READ0)
+        if (value == NAND_CMD_READ0) {
             s->offset = 0;
-	else if (value == NAND_CMD_READ1) {
+        } else if (value == NAND_CMD_READ1) {
             s->offset = 0x100;
             value = NAND_CMD_READ0;
-        }
-	else if (value == NAND_CMD_READ2) {
+        } else if (value == NAND_CMD_READ2) {
             s->offset = 1 << s->page_shift;
             value = NAND_CMD_READ0;
         }
@@ -508,8 +506,9 @@ void nand_setio(DeviceState *dev, uint32_t value)
                 s->cmd == NAND_CMD_BLOCKERASE2 ||
                 s->cmd == NAND_CMD_NOSERIALREAD2 ||
                 s->cmd == NAND_CMD_RANDOMREAD2 ||
-                s->cmd == NAND_CMD_RESET)
+                s->cmd == NAND_CMD_RESET) {
             nand_command(s);
+        }
 
         if (s->cmd != NAND_CMD_RANDOMREAD2) {
             s->addrlen = 0;
@@ -596,8 +595,9 @@ uint32_t nand_getio(DeviceState *dev)
             s->iolen = (1 << s->page_shift) + (1 << s->oob_shift) - offset;
     }
 
-    if (s->ce || s->iolen <= 0)
+    if (s->ce || s->iolen <= 0) {
         return 0;
+    }
 
     for (offset = s->buswidth; offset--;) {
         x |= s->ioaddr[offset] << (offset << 3);
@@ -696,8 +696,9 @@ static void glue(nand_blk_erase_, PAGE_SIZE)(NANDFlashState *s)
     uint8_t iobuf[0x200] = { [0 ... 0x1ff] = 0xff, };
     addr = s->addr & ~((1 << (ADDR_SHIFT + s->erase_shift)) - 1);
 
-    if (PAGE(addr) >= s->pages)
+    if (PAGE(addr) >= s->pages) {
         return;
+    }
 
     if (!s->bdrv) {
         memset(s->storage + PAGE_START(addr),
@@ -725,11 +726,12 @@ static void glue(nand_blk_erase_, PAGE_SIZE)(NANDFlashState *s)
         memset(iobuf, 0xff, 0x200);
         i = (addr & ~0x1ff) + 0x200;
         for (addr += ((PAGE_SIZE + OOB_SIZE) << s->erase_shift) - 0x200;
-                        i < addr; i += 0x200)
+                        i < addr; i += 0x200) {
             if (bdrv_write(s->bdrv, i >> 9, iobuf, 1) < 0) {
                 printf("%s: write error in sector %" PRIu64 "\n",
                        __func__, i >> 9);
             }
+        }
 
         page = i >> 9;
         if (bdrv_read(s->bdrv, page, iobuf, 1) < 0) {
@@ -745,8 +747,9 @@ static void glue(nand_blk_erase_, PAGE_SIZE)(NANDFlashState *s)
 static void glue(nand_blk_load_, PAGE_SIZE)(NANDFlashState *s,
                 uint64_t addr, int offset)
 {
-    if (PAGE(addr) >= s->pages)
+    if (PAGE(addr) >= s->pages) {
         return;
+    }
 
     if (s->bdrv) {
         if (s->mem_oob) {
Signature · 1 line
1.7.10.4
#17 lore raw

[Qemu-devel] [PULL 14/17] sd: pass bool parameter for sd_init

In reply to Michael Tokarev

From: liguang <[email protected]>

---
 hw/sd/milkymist-memcard.c |    2 +-
 hw/sd/omap_mmc.c          |    4 ++--
 hw/sd/pl181.c             |    2 +-
 hw/sd/pxa2xx_mmci.c       |    2 +-
 hw/sd/sdhci.c             |    2 +-
 hw/sd/ssi-sd.c            |    2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)
hw/sd/milkymist-memcard.c +1 -1
index d5944bc..61a8aad 100644
@@ -250,7 +250,7 @@ static int milkymist_memcard_init(SysBusDevice *dev)
     DriveInfo *dinfo;
 
     dinfo = drive_get_next(IF_SD);
-    s->card = sd_init(dinfo ? dinfo->bdrv : NULL, 0);
+    s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false);
     s->enabled = dinfo ? bdrv_is_inserted(dinfo->bdrv) : 0;
 
     memory_region_init_io(&s->regs_region, &memcard_mmio_ops, s,
hw/sd/omap_mmc.c +2 -2
index d4079cd..ba9f4b3 100644
@@ -592,7 +592,7 @@ struct omap_mmc_s *omap_mmc_init(hwaddr base,
     memory_region_add_subregion(sysmem, base, &s->iomem);
 
     /* Instantiate the storage */
-    s->card = sd_init(bd, 0);
+    s->card = sd_init(bd, false);
 
     return s;
 }
@@ -617,7 +617,7 @@ struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta,
     omap_l4_attach(ta, 0, &s->iomem);
 
     /* Instantiate the storage */
-    s->card = sd_init(bd, 0);
+    s->card = sd_init(bd, false);
 
     s->cdet = qemu_allocate_irqs(omap_mmc_cover_cb, s, 1)[0];
     sd_set_cb(s->card, NULL, s->cdet);
hw/sd/pl181.c +1 -1
index 2527296..e08fd04 100644
@@ -485,7 +485,7 @@ static int pl181_init(SysBusDevice *dev)
     sysbus_init_irq(dev, &s->irq[1]);
     qdev_init_gpio_out(&s->busdev.qdev, s->cardstatus, 2);
     dinfo = drive_get_next(IF_SD);
-    s->card = sd_init(dinfo ? dinfo->bdrv : NULL, 0);
+    s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false);
     return 0;
 }
 
hw/sd/pxa2xx_mmci.c +1 -1
index 2db1cab..0574d6b 100644
@@ -538,7 +538,7 @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem,
     memory_region_add_subregion(sysmem, base, &s->iomem);
 
     /* Instantiate the actual storage */
-    s->card = sd_init(bd, 0);
+    s->card = sd_init(bd, false);
 
     register_savevm(NULL, "pxa2xx_mmci", 0, 0,
                     pxa2xx_mmci_save, pxa2xx_mmci_load, s);
hw/sd/sdhci.c +1 -1
index 0065067..b9dd4be 100644
@@ -1165,7 +1165,7 @@ static void sdhci_initfn(Object *obj)
     DriveInfo *di;
 
     di = drive_get_next(IF_SD);
-    s->card = sd_init(di ? di->bdrv : NULL, 0);
+    s->card = sd_init(di ? di->bdrv : NULL, false);
     s->eject_cb = qemu_allocate_irqs(sdhci_insert_eject_cb, s, 1)[0];
     s->ro_cb = qemu_allocate_irqs(sdhci_card_readonly_cb, s, 1)[0];
     sd_set_cb(s->card, s->ro_cb, s->eject_cb);
hw/sd/ssi-sd.c +1 -1
index 4d3c4f6..d47e237 100644
@@ -245,7 +245,7 @@ static int ssi_sd_init(SSISlave *dev)
 
     s->mode = SSI_SD_CMD;
     dinfo = drive_get_next(IF_SD);
-    s->sd = sd_init(dinfo ? dinfo->bdrv : NULL, 1);
+    s->sd = sd_init(dinfo ? dinfo->bdrv : NULL, true);
     register_savevm(&dev->qdev, "ssi_sd", -1, 1, ssi_sd_save, ssi_sd_load, s);
     return 0;
 }
Signature · 1 line
1.7.10.4