The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dongli Zhang <dongli.zhang@oracle.com>
To: virtualization@lists.linux.dev
Cc: david@kernel.org, jasowang@redhat.com,
	xuanzhuo@linux.alibaba.com, eperezma@redhat.com,
	mhklinux@outlook.com, linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/1] virtio_balloon: pr_dev_info.report initialization cleanup
Date: Fri, 19 Dec 2025 16:30:12 -0800	[thread overview]
Message-ID: <20251220003012.78394-1-dongli.zhang@oracle.com> (raw)

The virtio_balloon vb->pr_dev_info is used as argument for
page_reporting_register() only when the VIRTIO_BALLOON_F_REPORTING feature
is available. There is no need to initialize vb->pr_dev_info.report if this
feature is unavailable.

Similarly, the Hyper-V balloon driver sets dm_device.pr_dev_info.report
only when the corresponding feature is present. If
page_reporting_register() fails, it even resets pr_dev_info.report back to
NULL.

No functional change. Only for cleanup.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
---
Changed since v1:
  - Add commit message to explain why we would want to do that.

 drivers/virtio/virtio_balloon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 74fe59f5a78c..0c39f2415324 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -1034,7 +1034,6 @@ static int virtballoon_probe(struct virtio_device *vdev)
 				 poison_val, &poison_val);
 	}
 
-	vb->pr_dev_info.report = virtballoon_free_page_report;
 	if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_REPORTING)) {
 		unsigned int capacity;
 
@@ -1044,6 +1043,8 @@ static int virtballoon_probe(struct virtio_device *vdev)
 			goto out_unregister_oom;
 		}
 
+		vb->pr_dev_info.report = virtballoon_free_page_report;
+
 		/*
 		 * The default page reporting order is @pageblock_order, which
 		 * corresponds to 512MB in size on ARM64 when 64KB base page
-- 
2.39.3


             reply	other threads:[~2025-12-20  0:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-20  0:30 Dongli Zhang [this message]
2025-12-21 11:19 ` [PATCH v2 1/1] virtio_balloon: pr_dev_info.report initialization cleanup David Hildenbrand (Red Hat)

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=20251220003012.78394-1-dongli.zhang@oracle.com \
    --to=dongli.zhang@oracle.com \
    --cc=david@kernel.org \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhklinux@outlook.com \
    --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