From nobody Mon Feb 9 19:05:39 2026 Received: from mail-244123.protonmail.ch (mail-244123.protonmail.ch [109.224.244.123]) (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 DCCFC2F1FC2 for ; Thu, 15 Jan 2026 19:20:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=109.224.244.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768504842; cv=none; b=g+g2Z/Bk3RuMR15t7bSE0aUq4lDWtDbZxWAhDg/JQP8ZhySxuDveKDEuqDQZGrO98F7tNwaMj7SQJbZJRFFsH/QPjMlHoopOBqiNNU0Jkorh3ci1Ygd+eOlQP5mc0LhZ8WNL1Ot+Gajg0byQJhhFBPNMwgKF0N/0+eBetata/GM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768504842; c=relaxed/simple; bh=KA9MXKxQIBvly1s3qKWEufqCl2vMdS+ESnCH1cHJ7Ys=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tvPDYFqgHDtTBZY5+/A6scXkEAehwJP9Vk6jwIk7/i4ybaWt9MBtNlAviCQ2LvbUv/S1aENisLxEtIL2TEZvr/e/05niVUqAmJK1+Uxuvj+WY0hYxygImuEjT/FRB5h4Zil4Un/XYF/jPMaSEnQkEbNKhj8/e+PAmLpmVn4M+EA= 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=TsWJt4p4; arc=none smtp.client-ip=109.224.244.123 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="TsWJt4p4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1768504838; x=1768764038; bh=KA9MXKxQIBvly1s3qKWEufqCl2vMdS+ESnCH1cHJ7Ys=; 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=TsWJt4p4OiO9W7NLo/Ay7O/XQjyBLvBYfGl4ottgfDEr3LReFo0N15cGwqCjx/Hl4 GpCZKZvKhS6KVQFjuDyC3zYESrw+OLTTnfr2CmnY3SWleHelU+ye0RxFRN8lkR2fUw GGOSD2HeLROuDadbOAOwY9FJPkoTETMnrBJSIOX6qPgifuRiP7kTva6R9vElIYxO8t ROSn0x4Bnf/xRlnEkfspa2Hf67mtd3HCJ7TcE+SvPEIvquhhUkCThALvohm+Prg27/ Irw1LS5rSYPsL6bOOqVHBDKVMNR+LikVWCDMrJo10Wf+gqMygpW06cGsEhzJBRCR7H s3nHMs1iI8aNg== Date: Thu, 15 Jan 2026 19:20:34 +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 06/12] gpib: gpio: Unify *allocate_private Message-ID: <20260115191925.52268-7-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: 024663f86e28416f555e0613959fb3f7d7319208 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/gpio/gpib_bitbang.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpib/gpio/gpib_bitbang.c b/drivers/gpib/gpio/gpib_bitb= ang.c index 374cd61355e9..3b8bd34f2f3d 100644 --- a/drivers/gpib/gpio/gpib_bitbang.c +++ b/drivers/gpib/gpio/gpib_bitbang.c @@ -1068,7 +1068,7 @@ static int allocate_private(struct gpib_board *board) { board->private_data =3D kzalloc(sizeof(struct bb_priv), GFP_KERNEL); if (!board->private_data) - return -1; + return -ENOMEM; return 0; } =20 @@ -1205,14 +1205,15 @@ static void bb_detach(struct gpib_board *board) static int bb_attach(struct gpib_board *board, const struct gpib_board_con= fig *config) { struct bb_priv *priv; - int retval =3D 0; + int retval; =20 dbg_printk(2, "%s\n", "Enter ..."); =20 board->status =3D 0; =20 - if (allocate_private(board)) - return -ENOMEM; + retval =3D allocate_private(board); + if (retval < 0) + return retval; priv =3D board->private_data; priv->direction =3D -1; priv->t1_delay =3D 2000; --=20 2.43.0