From nobody Tue Feb 10 04:03:05 2026 Received: from mail-106118.protonmail.ch (mail-106118.protonmail.ch [79.135.106.118]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85C8B155C82 for ; Thu, 15 Jan 2026 19:21:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.135.106.118 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768504888; cv=none; b=IA2h448U+EWuFmtJxQQG6z0X0bfwfcR3TGPOE+bLO4LsXBObM+SykRkoo4Rm4nXxvXEqwlGv11j1L60+C4pzB/Cp/qqoNMaB2a1OrBIntk+l1Khhf8F0ZpshW4brCrH17Bp5wPTK5NQM5OZvPYwkcDFXW1L0lcBW97Dk3UDIt1c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768504888; c=relaxed/simple; bh=vV/ABPIoxzepgSZiJOq0f/i6AFJ0I/6t+KH4wWyksVM=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jKt3tdhXOkfqvKk8qeLCoJesE19/fj5llWR2KVGyEaNP4sjkvXUWJrfa2cZfv2Tl1DQCdaSrR41uMPItqE+U4qtbAx7G6iCjSCIE48RgDb6qfWntT/b4Fz6xAxherzySh3u0bJ+OKBjBlJjJVTqThqzNJnDpG3XVWtxYoUlPpgg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com; spf=pass smtp.mailfrom=protonmail.com; dkim=pass (2048-bit key) header.d=protonmail.com header.i=@protonmail.com header.b=M3bjR37U; arc=none smtp.client-ip=79.135.106.118 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=protonmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=protonmail.com header.i=@protonmail.com header.b="M3bjR37U" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1768504879; x=1768764079; bh=vV/ABPIoxzepgSZiJOq0f/i6AFJ0I/6t+KH4wWyksVM=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=M3bjR37U2B0dv5sCv6SnAH73NWgwdufOhnTGBHtWYJ5casu+oE8N6sUeblrW7wgGv lfX4roZxCAQZbZrokwUc013wVcXr23oEMlJq0T5HJ6ouoR3hpNGUV7hKhDVjXQ3pD4 DygV+koaqrvHVYwcDVFKpCUE31+QVDkn9i6ZrMwQh7Ui/9YiLh79DEEnpvg53t/n3A yZOOnlrTp/Ip8bx3fMA9F+bHjNdyKUUGw1cD2/W1MiOq7G7fMizDmRJB0X1tqrWd6I 20VER14lAEUzXLifKhJ74OClMvVNdrTIh3ZgPzW+QgGifl0zPfqLjma5b3gFodRafV 598iKmy3td5nw== Date: Thu, 15 Jan 2026 19:21:13 +0000 To: Dave Penkler , Greg Kroah-Hartman , Michael Rubin , Dan Carpenter From: =?utf-8?Q?Dominik_Karol_Pi=C4=85tkowski?= Cc: linux-kernel@vger.kernel.org, =?utf-8?Q?Dominik_Karol_Pi=C4=85tkowski?= Subject: [PATCH v2 12/12] gpib: tnt4882: Unify *allocate_private Message-ID: <20260115191925.52268-13-dominik.karol.piatkowski@protonmail.com> In-Reply-To: <20260115191925.52268-1-dominik.karol.piatkowski@protonmail.com> References: <20260115191925.52268-1-dominik.karol.piatkowski@protonmail.com> Feedback-ID: 117888567:user:proton X-Pm-Message-ID: df15034504298cf2995873973f7ce8b04bc2dd67 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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=C4=85tkowski --- v2: Replace kmalloc/memset pairs to kzalloc. drivers/gpib/tnt4882/tnt4882_gpib.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/gpib/tnt4882/tnt4882_gpib.c b/drivers/gpib/tnt4882/tnt= 4882_gpib.c index c03a976b7380..e7e91ba17c2d 100644 --- a/drivers/gpib/tnt4882/tnt4882_gpib.c +++ b/drivers/gpib/tnt4882/tnt4882_gpib.c @@ -843,11 +843,10 @@ static int tnt4882_allocate_private(struct gpib_board= *board) { struct tnt4882_priv *tnt_priv; =20 - board->private_data =3D kmalloc(sizeof(struct tnt4882_priv), GFP_KERNEL); + board->private_data =3D kzalloc(sizeof(struct tnt4882_priv), GFP_KERNEL); if (!board->private_data) - return -1; + return -ENOMEM; tnt_priv =3D board->private_data; - memset(tnt_priv, 0, sizeof(struct tnt4882_priv)); init_nec7210_private(&tnt_priv->nec7210_priv); return 0; } @@ -916,8 +915,9 @@ static int ni_pci_attach(struct gpib_board *board, cons= t struct gpib_board_confi =20 board->status =3D 0; =20 - if (tnt4882_allocate_private(board)) - return -ENOMEM; + retval =3D tnt4882_allocate_private(board); + if (retval < 0) + return retval; tnt_priv =3D board->private_data; nec_priv =3D &tnt_priv->nec7210_priv; nec_priv->type =3D TNT4882; @@ -1039,8 +1039,9 @@ static int ni_isa_attach_common(struct gpib_board *bo= ard, const struct gpib_boar =20 board->status =3D 0; =20 - if (tnt4882_allocate_private(board)) - return -ENOMEM; + retval =3D tnt4882_allocate_private(board); + if (retval < 0) + return retval; tnt_priv =3D board->private_data; nec_priv =3D &tnt_priv->nec7210_priv; nec_priv->type =3D chipset; @@ -1725,8 +1726,9 @@ static int ni_pcmcia_attach(struct gpib_board *board,= const struct gpib_board_co =20 board->status =3D 0; =20 - if (tnt4882_allocate_private(board)) - return -ENOMEM; + retval =3D tnt4882_allocate_private(board); + if (retval < 0) + return retval; =20 tnt_priv =3D board->private_data; nec_priv =3D &tnt_priv->nec7210_priv; --=20 2.43.0