From nobody Sun Apr 5 13:23:58 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44ECBC32771 for ; Thu, 15 Sep 2022 20:30:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229704AbiIOUaQ (ORCPT ); Thu, 15 Sep 2022 16:30:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbiIOUaC (ORCPT ); Thu, 15 Sep 2022 16:30:02 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 758BB3A160 for ; Thu, 15 Sep 2022 13:30:00 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id dv25so44658743ejb.12 for ; Thu, 15 Sep 2022 13:30:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=Z8Qqwdo2MtVcZqXTy6aDXip/9KzF6Sq0fneVcEjjyRo=; b=L8Pucizs8ljkp8vk9wz/6AX3QAnAzERGaTZXN5Xtzt+Oksh3TboL9cp4Vdco/JnJ9m LlbMhu9CG4cmzLfCsNDj8OrF9eNx38/9YfccvNpA1nePgGyYrOdvAHXy4FrEMgki96ys fx70mupblp/elgVIYQmkTn80xwdSw1AUWalxe2CZV3+4YbLvoCEl2I41smd5f7ep1Als UNGlaP4Frt60oAyqTO8YZx1dxXIKKHfK9snJwxlEaMWUxQUNPYrj5JRKkZ60imoybskD GF1Z7u47PKSJJZ0ZcOonx7myW1AWh/89bwaPa4SJJ7Eg3vO+fQwaALIDh4epEm8+mYNd aBlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=Z8Qqwdo2MtVcZqXTy6aDXip/9KzF6Sq0fneVcEjjyRo=; b=afCkgsMy8dz8ECoIr2n1lPXybh6GKH2YTgAie8SW+4u3llJZ/rjseUqVRD0J7p8nsu 6ZypsrnloTkVfNNuBNVBWxhRfT0Sd9symoZEMbLoGunpclQxs4Ygs4V655boq8FIO9We k170ZExZGL72oTC9K6Os2dBLvn+9ae6w0FN0NjI4HiD9nrjS8VBWVdLIsMn4LyrmBshI PkpdJRshmDaKnm9OpEzZsnYzRp+FkmdEwTs/TAd5gWrgiWgLaGWAhKal06n/YMoZaIwl PKMS6n3kgDj5Ov/xoLGLSGFTdSjyOPcMkkYzIVU4oLv4+Qdn1gyw/z8HpCb9Jp2eeWac fdJA== X-Gm-Message-State: ACrzQf3rDaMBpjfzOvVXzNQ1Tdyy0Q74ogNLXeNP3X888x+UxFo9iPUQ 6ENE/X5QbiuZBaZ5NnnQM1s= X-Google-Smtp-Source: AMsMyM7V0C4G80Zc+gWypxx7ogIGlXVCzN3I+LiRymGBanw+Tl/rnn6iqK8FtO+uaoYijBl7RYVOFA== X-Received: by 2002:a17:907:320c:b0:77b:6f08:9870 with SMTP id xg12-20020a170907320c00b0077b6f089870mr1108419ejb.249.1663273799106; Thu, 15 Sep 2022 13:29:59 -0700 (PDT) Received: from localhost.localdomain (ip-217-105-46-43.ip.prioritytelecom.net. [217.105.46.43]) by smtp.gmail.com with ESMTPSA id ci25-20020a170906c35900b0072b3406e9c2sm9607295ejb.95.2022.09.15.13.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 13:29:58 -0700 (PDT) From: Nam Cao To: forest@alittletooquiet.net, gregkh@linuxfoundation.org Cc: namcaov@gmail.com, philipp.g.hortmann@gmail.com, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev Subject: [RFC PATCH 4/5] staging: vt6655: change device_alloc_rx_buf's argument Date: Thu, 15 Sep 2022 22:29:35 +0200 Message-Id: <40d72f6fdc3394a0bba15753d4f3b103bbc8332e.1663273218.git.namcaov@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The function device_alloc_rx_buf takes struct vnt_rx_desc as 1 argument, but only accesses the member rd_info of this struct. Change this argument to struct vnt_rd_info instead. This is preparation to implement correct out-of-memory error handling. Signed-off-by: Nam Cao --- drivers/staging/vt6655/device_main.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/= device_main.c index 27fe28156257..ca6c4266f010 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -132,7 +132,7 @@ static int device_init_td1_ring(struct vnt_private *pri= v); =20 static int device_rx_srv(struct vnt_private *priv, unsigned int idx); static int device_tx_srv(struct vnt_private *priv, unsigned int idx); -static bool device_alloc_rx_buf(struct vnt_private *, struct vnt_rx_desc *= ); +static bool device_alloc_rx_buf(struct vnt_private *, struct vnt_rd_info *= ); static void device_init_rx_desc(struct vnt_private *priv, struct vnt_rx_de= sc *rd); static void device_free_rx_buf(struct vnt_private *priv, struct vnt_rx_desc *rd); @@ -612,7 +612,7 @@ static int device_init_rd0_ring(struct vnt_private *pri= v) goto err_free_desc; } =20 - if (!device_alloc_rx_buf(priv, desc)) { + if (!device_alloc_rx_buf(priv, desc->rd_info)) { dev_err(&priv->pcid->dev, "can not alloc rx bufs\n"); ret =3D -ENOMEM; goto err_free_rd; @@ -660,7 +660,7 @@ static int device_init_rd1_ring(struct vnt_private *pri= v) goto err_free_desc; } =20 - if (!device_alloc_rx_buf(priv, desc)) { + if (!device_alloc_rx_buf(priv, desc->rd_info)) { dev_err(&priv->pcid->dev, "can not alloc rx bufs\n"); ret =3D -ENOMEM; goto err_free_rd; @@ -839,7 +839,7 @@ static int device_rx_srv(struct vnt_private *priv, unsi= gned int idx) =20 vnt_receive_frame(priv, rd); =20 - if (!device_alloc_rx_buf(priv, rd)) { + if (!device_alloc_rx_buf(priv, rd->rd_info)) { dev_err(&priv->pcid->dev, "can not allocate rx buf\n"); break; @@ -856,10 +856,8 @@ static int device_rx_srv(struct vnt_private *priv, uns= igned int idx) } =20 static bool device_alloc_rx_buf(struct vnt_private *priv, - struct vnt_rx_desc *rd) + struct vnt_rd_info *rd_info) { - struct vnt_rd_info *rd_info =3D rd->rd_info; - rd_info->skb =3D dev_alloc_skb((int)priv->rx_buf_sz); if (!rd_info->skb) return false; --=20 2.25.1