From: Dave Penkler <dpenkler@gmail.com>
To: Dominik Karol Pi??tkowski <dominik.karol.piatkowski@protonmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Michael Rubin <matchstick@neverthere.org>,
Dan Carpenter <dan.carpenter@linaro.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/9] gpib: cec: Unify *allocate_private
Date: Thu, 15 Jan 2026 17:29:44 +0100 [thread overview]
Message-ID: <aWkV-MCweRp1ZF0b@egonzo> (raw)
In-Reply-To: <20260113190759.54355-4-dominik.karol.piatkowski@protonmail.com>
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@protonmail.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 ?
> 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
>
>
next prev parent reply other threads:[~2026-01-15 16:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-13 19:08 [PATCH 0/9] gpib: Unify *allocate_private Dominik Karol Piątkowski
2026-01-13 19:08 ` [PATCH 1/9] gpib: agilent_82350b: " Dominik Karol Piątkowski
2026-01-16 7:36 ` Greg Kroah-Hartman
2026-01-16 14:45 ` Dominik Karol Piątkowski
2026-01-13 19:08 ` [PATCH 2/9] gpib: cb7210: " Dominik Karol Piątkowski
2026-01-13 19:08 ` [PATCH 3/9] gpib: cec: " Dominik Karol Piątkowski
2026-01-15 16:29 ` Dave Penkler [this message]
2026-01-15 18:11 ` Dominik Karol Piątkowski
2026-01-16 7:50 ` Greg Kroah-Hartman
2026-01-13 19:09 ` [PATCH 4/9] gpib: gpio: " Dominik Karol Piątkowski
2026-01-13 19:09 ` [PATCH 5/9] gpib: hp_82335: " Dominik Karol Piątkowski
2026-01-13 19:09 ` [PATCH 6/9] gpib: hp_82341: " Dominik Karol Piątkowski
2026-01-13 19:09 ` [PATCH 7/9] gpib: ines: " Dominik Karol Piątkowski
2026-01-13 19:09 ` [PATCH 8/9] gpib: pc2: " Dominik Karol Piątkowski
2026-01-13 19:09 ` [PATCH 9/9] gpib: tnt4882: " Dominik Karol Piątkowski
2026-01-19 7:34 ` [PATCH 0/9] gpib: " Dan Carpenter
2026-01-20 16:12 ` Dominik Karol Piątkowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aWkV-MCweRp1ZF0b@egonzo \
--to=dpenkler@gmail.com \
--cc=dan.carpenter@linaro.org \
--cc=dominik.karol.piatkowski@protonmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matchstick@neverthere.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox