[PATCH v2 08/12] gpib: hp_82341: Unify *allocate_private

From: Dominik Karol Piątkowski

Date: Thu Jan 15 2026 - 14:20:58 EST


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. Replace kmalloc/memset pairs to kzalloc.

Signed-off-by: Dominik Karol Piątkowski <dominik.karol.piatkowski@xxxxxxxxxxxxxx>
---

v2: Replace kmalloc/memset pairs to kzalloc.

drivers/gpib/hp_82341/hp_82341.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpib/hp_82341/hp_82341.c b/drivers/gpib/hp_82341/hp_82341.c
index 1a2ad0560e14..4a2440fe160f 100644
--- a/drivers/gpib/hp_82341/hp_82341.c
+++ b/drivers/gpib/hp_82341/hp_82341.c
@@ -693,8 +693,9 @@ static int hp_82341_attach(struct gpib_board *board, const struct gpib_board_con
int retval;

board->status = 0;
- if (hp_82341_allocate_private(board))
- return -ENOMEM;
+ retval = hp_82341_allocate_private(board);
+ if (retval < 0)
+ return retval;
hp_priv = board->private_data;
tms_priv = &hp_priv->tms9914_priv;
tms_priv->read_byte = hp_82341_read_byte;
--
2.43.0