qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/3] hw/core: report an error if invalid gpio is


From: Alistair Francis
Subject: Re: [Qemu-devel] [PATCH 3/3] hw/core: report an error if invalid gpio is used
Date: Mon, 26 Jun 2017 15:39:13 -0700

On Fri, Jun 23, 2017 at 9:45 AM, Philippe Mathieu-Daudé <address@hidden> wrote:
> then abort calling error_setg()

The commit message should be able to be read separately from the title.

Once you fix up the message:

Reviewed-by: Alistair Francis <address@hidden>

Thanks,
Alistair

>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
>  hw/core/qdev.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 849952a8d4..05aaa67cb8 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -448,7 +448,11 @@ qemu_irq qdev_get_gpio_in_named(DeviceState *dev, const 
> char *name, int n)
>  {
>      NamedGPIOList *gpio_list = qdev_get_named_gpio_list(dev, name);
>
> -    assert(n >= 0 && n < gpio_list->num_in);
> +    assert(n >= 0);
> +    if (n >= gpio_list->num_in) {
> +        error_setg(&error_abort, "Invalid gpio #%d (of %d) for %s",
> +                   n, gpio_list->num_in, name ? name : "device");
> +    }
>      return gpio_list->in[n];
>  }
>
> --
> 2.13.1
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]