From 3c0d8c38a09df636c93306a0708d9def4a4ca63f Mon Sep 17 00:00:00 2001 From: Federico Vaga <federico.vaga@cern.ch> Date: Thu, 3 Dec 2015 15:15:14 +0100 Subject: [PATCH] vmod:[fix] lun_to_dev() must check all device instances Problem: if you declare the first vmod module with LUN=2 (or any number grater than 0) then the driver will not load the mezzanines. The real device instance is stored in device_table according to its LUN. This means that we have to loop over all the table to find the correct instance. Before the condition was the device instances counter. Signed-off-by: Federico Vaga <federico.vaga@cern.ch> --- vmod/driver/vmodio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vmod/driver/vmodio.c b/vmod/driver/vmodio.c index 4c8311d6..51826459 100644 --- a/vmod/driver/vmodio.c +++ b/vmod/driver/vmodio.c @@ -79,7 +79,7 @@ static struct vmodio *lun_to_dev(int lun) { int i = 0; - for (i = 0; i < devices; i++) { + for (i = 0; i < MAX_DEVICES; i++) { struct vmodio *dev = &device_table[i]; if (dev->lun == lun) return dev; -- GitLab