utils: codegen: controls.py: Fix missing direction error message
diff mbox series

Message ID 20250108222950.1317759-1-paul.elder@ideasonboard.com
State Accepted
Headers show
Series
  • utils: codegen: controls.py: Fix missing direction error message
Related show

Commit Message

Paul Elder Jan. 8, 2025, 10:29 p.m. UTC
The error message for missing direction field prints the direction value
(usually 'None') instead of the name of the field 'direction'. Fix this.

Fixes: 39fe4ad96803 ("utils: codegen: controls.py: Parse direction information")
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
 utils/codegen/controls.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Pinchart Jan. 8, 2025, 11:04 p.m. UTC | #1
Hi Paul,

Thank you for the patch.

On Wed, Jan 08, 2025 at 04:29:50PM -0600, Paul Elder wrote:
> The error message for missing direction field prints the direction value
> (usually 'None') instead of the name of the field 'direction'. Fix this.
> 
> Fixes: 39fe4ad96803 ("utils: codegen: controls.py: Parse direction information")
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  utils/codegen/controls.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/codegen/controls.py b/utils/codegen/controls.py
> index 602f15b25..e51610481 100644
> --- a/utils/codegen/controls.py
> +++ b/utils/codegen/controls.py
> @@ -65,7 +65,7 @@ class Control(object):
>          else:
>              direction = self.__data.get('direction')
>              if direction is None:
> -                raise RuntimeError(f'Control `{self.__name}` missing required field `{direction}`')
> +                raise RuntimeError(f'Control `{self.__name}` missing required field `direction`')
>              if direction not in ['in', 'out', 'inout']:
>                  raise RuntimeError(f'Control `{self.__name}` direction `{direction}` is invalid; must be one of `in`, `out`, or `inout`')
>              self.__direction = direction
Kieran Bingham Jan. 9, 2025, 9:45 a.m. UTC | #2
Quoting Laurent Pinchart (2025-01-08 23:04:56)
> Hi Paul,
> 
> Thank you for the patch.
> 
> On Wed, Jan 08, 2025 at 04:29:50PM -0600, Paul Elder wrote:
> > The error message for missing direction field prints the direction value
> > (usually 'None') instead of the name of the field 'direction'. Fix this.
> > 
> > Fixes: 39fe4ad96803 ("utils: codegen: controls.py: Parse direction information")
> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> > ---
> >  utils/codegen/controls.py | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/utils/codegen/controls.py b/utils/codegen/controls.py
> > index 602f15b25..e51610481 100644
> > --- a/utils/codegen/controls.py
> > +++ b/utils/codegen/controls.py
> > @@ -65,7 +65,7 @@ class Control(object):
> >          else:
> >              direction = self.__data.get('direction')
> >              if direction is None:
> > -                raise RuntimeError(f'Control `{self.__name}` missing required field `{direction}`')
> > +                raise RuntimeError(f'Control `{self.__name}` missing required field `direction`')

Indeed, I can see how that printing None isn't helpful ;-)


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> >              if direction not in ['in', 'out', 'inout']:
> >                  raise RuntimeError(f'Control `{self.__name}` direction `{direction}` is invalid; must be one of `in`, `out`, or `inout`')
> >              self.__direction = direction
> 
> -- 
> Regards,
> 
> Laurent Pinchart

Patch
diff mbox series

diff --git a/utils/codegen/controls.py b/utils/codegen/controls.py
index 602f15b25..e51610481 100644
--- a/utils/codegen/controls.py
+++ b/utils/codegen/controls.py
@@ -65,7 +65,7 @@  class Control(object):
         else:
             direction = self.__data.get('direction')
             if direction is None:
-                raise RuntimeError(f'Control `{self.__name}` missing required field `{direction}`')
+                raise RuntimeError(f'Control `{self.__name}` missing required field `direction`')
             if direction not in ['in', 'out', 'inout']:
                 raise RuntimeError(f'Control `{self.__name}` direction `{direction}` is invalid; must be one of `in`, `out`, or `inout`')
             self.__direction = direction