[PATCH v2 01/12] gpib: agilent_82350b: Unify *allocate_private

Dominik Karol Piątkowski posted 12 patches 3 weeks, 3 days ago
There is a newer version of this series
[PATCH v2 01/12] gpib: agilent_82350b: Unify *allocate_private
Posted by Dominik Karol Piątkowski 3 weeks, 3 days ago
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@protonmail.com>
---

v2: Replace kmalloc/memset pairs to kzalloc.

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

diff --git a/drivers/gpib/agilent_82350b/agilent_82350b.c b/drivers/gpib/agilent_82350b/agilent_82350b.c
index 01a5bb43cd2d..f5f102863e47 100644
--- a/drivers/gpib/agilent_82350b/agilent_82350b.c
+++ b/drivers/gpib/agilent_82350b/agilent_82350b.c
@@ -599,8 +599,9 @@ static int agilent_82350b_generic_attach(struct gpib_board *board,
 
 	board->status = 0;
 
-	if (agilent_82350b_allocate_private(board))
-		return -ENOMEM;
+	retval = agilent_82350b_allocate_private(board);
+	if (retval < 0)
+		return retval;
 	a_priv = board->private_data;
 	a_priv->using_fifos = use_fifos;
 	tms_priv = &a_priv->tms9914_priv;
-- 
2.43.0
Re: [PATCH v2 01/12] gpib: agilent_82350b: Unify *allocate_private
Posted by Greg Kroah-Hartman 3 weeks, 3 days ago
On Thu, Jan 15, 2026 at 07:20:04PM +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. Replace kmalloc/memset pairs to kzalloc.

This is multiple things in the same patch, which is not a good idea.
Each change should just do one logical thing, this should be broken up
into much smaller pieces.

thanks,

greg k-h
Re: [PATCH v2 01/12] gpib: agilent_82350b: Unify *allocate_private
Posted by Greg Kroah-Hartman 3 weeks, 3 days ago
On Thu, Jan 15, 2026 at 07:20:04PM +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. Replace kmalloc/memset pairs to kzalloc.

Wait, there is no kzalloc change here.  You used the same changelog for
all of these patches :(