You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2025/03/13 19:37:27 UTC

(nuttx) branch master updated: fs/virtio-9p:When virtio-9p is not supported, return -ENODEV

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 91d895d9a2 fs/virtio-9p:When virtio-9p is not supported, return -ENODEV
91d895d9a2 is described below

commit 91d895d9a29761aea800ff483a8da2501fbff16f
Author: chenrun1 <ch...@xiaomi.com>
AuthorDate: Sat Feb 8 16:51:50 2025 +0800

    fs/virtio-9p:When virtio-9p is not supported, return -ENODEV
    
    Summary:
      When the operating environment does not support virtio-9p and the virtio-9p server driver is not provided, -ENODEV should be returned for virtio-9p to avoid crash caused by continued execution.
    
    Signed-off-by: chenrun1 <ch...@xiaomi.com>
---
 fs/v9fs/virtio_9p.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/v9fs/virtio_9p.c b/fs/v9fs/virtio_9p.c
index 8e7cc8fb8d..5681173980 100644
--- a/fs/v9fs/virtio_9p.c
+++ b/fs/v9fs/virtio_9p.c
@@ -127,6 +127,13 @@ static int virtio_9p_create(FAR struct v9fs_transport_s **transport,
   priv->transport.ops = &g_virtio_9p_transport_ops;
   *transport = &priv->transport;
   ret = virtio_register_driver(&priv->vdrv);
+  if (priv->vdev == NULL)
+    {
+      /* No corresponding driver was found, we should return an error */
+
+      ret = -ENODEV;
+    }
+
   if (ret < 0)
     {
       fs_heap_free(priv);