From nobody Mon Feb 9 19:05:38 2026 Received: from mail-24417.protonmail.ch (mail-24417.protonmail.ch [109.224.244.17]) (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 72AE52EBDDE for ; Thu, 15 Jan 2026 19:20:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=109.224.244.17 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768504823; cv=none; b=kblT6M4K4ePnddzKUS1Tk8ndsyGWB6RqWwuk/St4Qrm2QcNmuxis+0z0GSF5032TASkvhmohmsS4x5BAh/P4FWbSa11OILf+c+Vk2uw+ac4Ux7oN144zEvmZq0+buHKYO+jDXtzJgImURFbttRwtDJ/N8r3vrXWWaLA3bBPEiEc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768504823; c=relaxed/simple; bh=ebsKHasvE/+sve0wlit3BeNi0E8bB7dFuuxOB1wMqVE=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PAQ+Rpzedk1Kh1dob2z4h70qHkjnfp7MXr5BxcxgwuIpwrABdEUUgQ+1Ig4TBHfzhZTrOtkyXymynwRI3i2g8cz5MHhfhbU9uWqscSA8ele7imGyKz6GPGwtyC0pB4E2D4n42keP5iC9mFntxe/KvTtCigefohGWMyG1trPb5fo= 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=JcpnSUSt; arc=none smtp.client-ip=109.224.244.17 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="JcpnSUSt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1768504813; x=1768764013; bh=ebsKHasvE/+sve0wlit3BeNi0E8bB7dFuuxOB1wMqVE=; 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=JcpnSUStqX4MBSHyJU1MKNAhN+YGcRhwvjS56pGrV+hxHcyqhvOJxZEdCbWGS+O9s ihDOkw1c9peIDD/Efwb99AUr+adJ9uxpDRrv+bhDkJvSsTJaDZJ5L0nSyHYHimRZCL r6D6vKFNYcnMU2xPCknRs62YLZz8W5IANNLRt3mZZbIPXUMcTvDW++k79fGwGkX3XV /TR8VeHGK/dnTl/PfUaGvBYiG0EwLLFk2ARmIxyRfgcw9C9hXmYb5RT1jeNkP8yAXW Xk/PrvcEJv2XAXNf6z3fpL5KSVR89SJ2zP8ngFctKCKZsyVB9Erag5iupspdYUqWy4 owFfxtehAxCtg== Date: Thu, 15 Jan 2026 19:20:10 +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 02/12] gpib: cb7210: Unify *allocate_private Message-ID: <20260115191925.52268-3-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: 037642305ac79ee696bd01eb6395fb4d9fe1d1a9 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/cb7210/cb7210.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpib/cb7210/cb7210.c b/drivers/gpib/cb7210/cb7210.c index 24c61b151071..6395f89d0f3c 100644 --- a/drivers/gpib/cb7210/cb7210.c +++ b/drivers/gpib/cb7210/cb7210.c @@ -856,11 +856,10 @@ static int cb7210_allocate_private(struct gpib_board = *board) { struct cb7210_priv *priv; =20 - board->private_data =3D kmalloc(sizeof(struct cb7210_priv), GFP_KERNEL); + board->private_data =3D kzalloc(sizeof(struct cb7210_priv), GFP_KERNEL); if (!board->private_data) return -ENOMEM; priv =3D board->private_data; - memset(priv, 0, sizeof(struct cb7210_priv)); init_nec7210_private(&priv->nec7210_priv); return 0; } @@ -876,11 +875,13 @@ static int cb7210_generic_attach(struct gpib_board *b= oard) { struct cb7210_priv *cb_priv; struct nec7210_priv *nec_priv; + int retval; =20 board->status =3D 0; =20 - if (cb7210_allocate_private(board)) - return -ENOMEM; + retval =3D cb7210_allocate_private(board); + if (retval < 0) + return retval; cb_priv =3D board->private_data; nec_priv =3D &cb_priv->nec7210_priv; nec_priv->read_byte =3D nec7210_locking_ioport_read_byte; --=20 2.43.0