diff mbox series

[v2,7/9] ccid-card-passthru: Use QERR_MISSING_PARAMETER

Message ID 20190214201939.494-8-philmd@redhat.com
State New
Headers show
Series ccid-card-passthru: check buffer size parameter | expand

Commit Message

Philippe Mathieu-Daudé Feb. 14, 2019, 8:19 p.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/usb/ccid-card-passthru.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Eric Blake Feb. 14, 2019, 9:22 p.m. UTC | #1
On 2/14/19 2:19 PM, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/usb/ccid-card-passthru.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
> index 6cb8b2d26b..d63aa28584 100644
> --- a/hw/usb/ccid-card-passthru.c
> +++ b/hw/usb/ccid-card-passthru.c
> @@ -16,6 +16,7 @@
>  #include "qemu/sockets.h"
>  #include "ccid.h"
>  #include "qapi/error.h"
> +#include "qapi/qmp/qerror.h"
>  
>  #define DPRINTF(card, lvl, fmt, ...)                    \
>  do {                                                    \
> @@ -339,7 +340,7 @@ static void passthru_realize(CCIDCardState *base, Error **errp)
>      PassthruState *card = PASSTHRU_CCID_CARD(base);
>  
>      if (!qemu_chr_fe_backend_connected(&card->cs)) {
> -        error_setg(errp, "missing chardev");
> +        error_setg(errp, QERR_MISSING_PARAMETER, "chardev");

We're trying to get rid of QERR_ usage, not add more. But this
particular one seems to be a wash:

$ git grep '"missing ' | wc -l
24
$ git grep QERR_MISSING_P | wc -l
25

so I'd be interested if Markus has an opinion on this one.
diff mbox series

Patch

diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
index 6cb8b2d26b..d63aa28584 100644
--- a/hw/usb/ccid-card-passthru.c
+++ b/hw/usb/ccid-card-passthru.c
@@ -16,6 +16,7 @@ 
 #include "qemu/sockets.h"
 #include "ccid.h"
 #include "qapi/error.h"
+#include "qapi/qmp/qerror.h"
 
 #define DPRINTF(card, lvl, fmt, ...)                    \
 do {                                                    \
@@ -339,7 +340,7 @@  static void passthru_realize(CCIDCardState *base, Error **errp)
     PassthruState *card = PASSTHRU_CCID_CARD(base);
 
     if (!qemu_chr_fe_backend_connected(&card->cs)) {
-        error_setg(errp, "missing chardev");
+        error_setg(errp, QERR_MISSING_PARAMETER, "chardev");
         return;
     }
     card->vscard_in_pos = 0;