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 <chenrun1@xiaomi.com>
This commit is contained in:
chenrun1 2025-02-08 16:51:50 +08:00 committed by Alan C. Assis
parent e0b02314e6
commit 91d895d9a2

View File

@ -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);