diff mbox series

[01/16] error: Add error_vprepend() in comment of ERRP_GUARD() rules

Message ID 20240228163723.1775791-2-zhao1.liu@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series Cleanup up to fix missing ERRP_GUARD() for error_prepend() | expand

Commit Message

Zhao Liu Feb. 28, 2024, 4:37 p.m. UTC
From: Zhao Liu <zhao1.liu@intel.com>

The error_vprepend() should use ERRP_GUARD() just as the documentation
of ERRP_GUARD() says:

> It must be used when the function dereferences @errp or passes
> @errp to error_prepend(), error_vprepend(), or error_append_hint().

Considering that error_vprepend() is also an API provided in error.h,
it is necessary to add it to the description of the rules for using
ERRP_GUARD().

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 include/qapi/error.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Markus Armbruster Feb. 29, 2024, 2:42 p.m. UTC | #1
Zhao Liu <zhao1.liu@linux.intel.com> writes:

> From: Zhao Liu <zhao1.liu@intel.com>
>
> The error_vprepend() should use ERRP_GUARD() just as the documentation
> of ERRP_GUARD() says:
>
>> It must be used when the function dereferences @errp or passes
>> @errp to error_prepend(), error_vprepend(), or error_append_hint().
>
> Considering that error_vprepend() is also an API provided in error.h,
> it is necessary to add it to the description of the rules for using
> ERRP_GUARD().
>
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
>  include/qapi/error.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/qapi/error.h b/include/qapi/error.h
> index f21a231bb1a6..b1b389967f92 100644
> --- a/include/qapi/error.h
> +++ b/include/qapi/error.h
> @@ -207,7 +207,7 @@
>   *
>   * Without ERRP_GUARD(), use of the @errp parameter is restricted:
>   * - It must not be dereferenced, because it may be null.
> - * - It should not be passed to error_prepend() or
> + * - It should not be passed to error_prepend(), error_vprepend() or
>   *   error_append_hint(), because that doesn't work with &error_fatal.
>   * ERRP_GUARD() lifts these restrictions.
>   *

Good catch!

I'd like a comma after error_vprepend().

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Zhao Liu Feb. 29, 2024, 3:50 p.m. UTC | #2
> >   * Without ERRP_GUARD(), use of the @errp parameter is restricted:
> >   * - It must not be dereferenced, because it may be null.
> > - * - It should not be passed to error_prepend() or
> > + * - It should not be passed to error_prepend(), error_vprepend() or
> >   *   error_append_hint(), because that doesn't work with &error_fatal.
> >   * ERRP_GUARD() lifts these restrictions.
> >   *
> 
> Good catch!
> 
> I'd like a comma after error_vprepend().
> 
> Reviewed-by: Markus Armbruster <armbru@redhat.com>

Thanks! I'll.

Regards,
Zhao
diff mbox series

Patch

diff --git a/include/qapi/error.h b/include/qapi/error.h
index f21a231bb1a6..b1b389967f92 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -207,7 +207,7 @@ 
  *
  * Without ERRP_GUARD(), use of the @errp parameter is restricted:
  * - It must not be dereferenced, because it may be null.
- * - It should not be passed to error_prepend() or
+ * - It should not be passed to error_prepend(), error_vprepend() or
  *   error_append_hint(), because that doesn't work with &error_fatal.
  * ERRP_GUARD() lifts these restrictions.
  *