From: Li Wang <liwang@kylinos.cn>
To: "Michael S . Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>
Cc: "Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
netdev@vger.kernel.org, virtualization@lists.linux.dev,
linux-kernel@vger.kernel.org, "Li Wang" <liwang@kylinos.cn>
Subject: [PATCH] virtio_net: drop redundant err assignment in virtnet_probe()
Date: Wed, 20 May 2026 18:23:09 +0800 [thread overview]
Message-ID: <20260520102309.281616-1-liwang@kylinos.cn> (raw)
err is initialized to -ENOMEM at the start of virtnet_probe(), and no
code path between that and the devm_kzalloc() failure can change
err. Assigning -ENOMEM again before goto free therefore is redundant.
Signed-off-by: Li Wang <liwang@kylinos.cn>
---
drivers/net/virtio_net.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index f4adcfee7a80..1fbafca90e4c 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -6853,10 +6853,8 @@ static int virtnet_probe(struct virtio_device *vdev)
rss_max_indirection_table_length));
}
vi->rss_hdr = devm_kzalloc(&vdev->dev, virtnet_rss_hdr_size(vi), GFP_KERNEL);
- if (!vi->rss_hdr) {
- err = -ENOMEM;
+ if (!vi->rss_hdr)
goto free;
- }
if (vi->has_rss || vi->has_rss_hash_report) {
key_sz = virtio_cread8(vdev, offsetof(struct virtio_net_config, rss_max_key_size));
--
2.34.1
next reply other threads:[~2026-05-20 10:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 10:23 Li Wang [this message]
2026-05-25 18:49 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260520102309.281616-1-liwang@kylinos.cn \
--to=liwang@kylinos.cn \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®