Skip to content

Commit

Permalink
virtio: don't fail on !of_device_is_compatible
Browse files Browse the repository at this point in the history
A recent change checking of_device_is_compatible on probe broke some
powerpc/pseries setups. Apparently there virtio devices do not have a
"compatible" property - they are matched by PCI vendor/device ids.

Let's just skip of_node setup but proceed with initialization like we
did previously.

Fixes: 694a111 ("virtio: Bind virtio device to device-tree node")
Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
Michael S. Tsirkin committed Sep 14, 2021
1 parent 6880fa6 commit 0d81870
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/virtio/virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,13 @@ static int virtio_device_of_init(struct virtio_device *dev)
ret = snprintf(compat, sizeof(compat), "virtio,device%x", dev->id.device);
BUG_ON(ret >= sizeof(compat));

/*
* On powerpc/pseries virtio devices are PCI devices so PCI
* vendor/device ids play the role of the "compatible" property.
* Simply don't init of_node in this case.
*/
if (!of_device_is_compatible(np, compat)) {
ret = -EINVAL;
ret = 0;
goto out;
}

Expand Down

0 comments on commit 0d81870

Please sign in to comment.