Module: xenomai-abe
Branch: analogy
Commit: 41cd9059ee3a0880ff3a22f51ddaf9a6ba07fdaf
URL:    
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=41cd9059ee3a0880ff3a22f51ddaf9a6ba07fdaf

Author: Alexis Berlemont <alexis.berlem...@gmail.com>
Date:   Wed Jan  6 23:07:59 2010 +0100

analogy: fix an ugly access in NI MIO driver

In the function init_ao_67xx(), the AO subdevice pointer was retrieved
by going through the transfer structure which initialization is not
complete.

---

 .../analogy/national_instruments/mio_common.c      |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/ksrc/drivers/analogy/national_instruments/mio_common.c 
b/ksrc/drivers/analogy/national_instruments/mio_common.c
index c722384..db9762a 100644
--- a/ksrc/drivers/analogy/national_instruments/mio_common.c
+++ b/ksrc/drivers/analogy/national_instruments/mio_common.c
@@ -3732,9 +3732,14 @@ void mio_common_detach(a4l_dev_t * dev)
 
 static void init_ao_67xx(a4l_dev_t * dev)
 {
-       a4l_subd_t *subd = dev->transfer.subds[NI_AO_SUBDEV];
+       a4l_subd_t *subd = a4l_get_subd(dev, NI_AO_SUBDEV);
        int i;
 
+       if (subd == NULL) {
+               a4l_err(dev, "%s: unable to find AO subdevice\n", __FUNCTION__);
+               return;
+       }
+
        for (i = 0; i < subd->chan_desc->length; i++)
                ni_ao_win_outw(dev, AO_Channel(i) | 0x0,
                               AO_Configuration_2_67xx);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to