From 81ac4d3934929d79fbddbac114efd73ebdebfe6f Mon Sep 17 00:00:00 2001 From: Yongrong Wang Date: Tue, 8 Oct 2024 10:37:46 +0800 Subject: [PATCH] openamp/virtio.h: make final_features optional negotiate also can be call when final_features is NULL Signed-off-by: Yongrong Wang --- lib/include/openamp/virtio.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/include/openamp/virtio.h b/lib/include/openamp/virtio.h index 983228c4f..278d2da78 100644 --- a/lib/include/openamp/virtio.h +++ b/lib/include/openamp/virtio.h @@ -468,14 +468,15 @@ static inline int virtio_negotiate_features(struct virtio_device *vdev, uint32_t features, uint32_t *final_features) { - if (!vdev || !final_features) + if (!vdev) return -EINVAL; if (!vdev->func || !vdev->func->negotiate_features) return -ENXIO; - *final_features = vdev->func->negotiate_features(vdev, features); - vdev->features = *final_features; + vdev->features = vdev->func->negotiate_features(vdev, features); + if (final_features) + *final_features = vdev->features; return 0; }