[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <mcxyBp8mwbb7tfDVbMrTDuvYiZNcgGP3WkF0ZFBfaJc2NWGIFJIFeh6PfPAkZeWciuDo33LmAj9g646fBau7pph7FgJyGUR8VFowojlK6n0=@protonmail.com>
Date: Thu, 15 Jan 2026 18:11:40 +0000
From: Dominik Karol PiÄ…tkowski <dominik.karol.piatkowski@...tonmail.com>
To: Dave Penkler <dpenkler@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Michael Rubin <matchstick@...erthere.org>, Dan Carpenter <dan.carpenter@...aro.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/9] gpib: cec: Unify *allocate_private
Hi Dave,
On Thursday, January 15th, 2026 at 17:29, Dave Penkler <dpenkler@...il.com> wrote:
>
>
> On Tue, Jan 13, 2026 at 07:08:56PM +0000, Dominik Karol Pi??tkowski wrote:
>
> > Return values for *allocate_private functions as well as calling code in
> > gpib driver are all over the place. Unify them by returning -errno if
> > something fails, zero otherwise. Use the returned value as early return
> > value in case of error.
> >
> > Signed-off-by: Dominik Karol Pi??tkowski dominik.karol.piatkowski@...tonmail.com
> > ---
> > drivers/gpib/cec/cec_gpib.c | 8 +++++---
> > 1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpib/cec/cec_gpib.c b/drivers/gpib/cec/cec_gpib.c
> > index dbf9b95baabc..6d04becd1058 100644
> > --- a/drivers/gpib/cec/cec_gpib.c
> > +++ b/drivers/gpib/cec/cec_gpib.c
> > @@ -222,7 +222,7 @@ static int cec_allocate_private(struct gpib_board *board)
> >
> > board->private_data = kmalloc(sizeof(struct cec_priv), GFP_KERNEL);
>
>
> Maybe you could change all the remaining kmalloc/memset pairs to kzalloc at the same time ?
Sure, thanks for the suggestion!
Dominik Karol
>
> > if (!board->private_data)
> > - return -1;
> > + return -ENOMEM;
> > priv = board->private_data;
> > memset(priv, 0, sizeof(struct cec_priv));
> > init_nec7210_private(&priv->nec7210_priv);
> > @@ -239,11 +239,13 @@ static int cec_generic_attach(struct gpib_board *board)
> > {
> > struct cec_priv *cec_priv;
> > struct nec7210_priv *nec_priv;
> > + int retval;
> >
> > board->status = 0;
> >
> > - if (cec_allocate_private(board))
> > - return -ENOMEM;
> > + retval = cec_allocate_private(board);
> > + if (retval < 0)
> > + return retval;
> > cec_priv = board->private_data;
> > nec_priv = &cec_priv->nec7210_priv;
> > nec_priv->read_byte = nec7210_ioport_read_byte;
> > --
> > 2.43.0
Powered by blists - more mailing lists