Hello,

attached is a patch changing:

   * ksrc/drivers/can/rtcan_dev.c (rtcan_dev_register): Bug fixed
   when maximum number of devices is exeeded.

BTW, a similar bug is present in RTnet as well.

Wolfgang.
+ diff -u xenomai/ChangeLog-ENOMEM xenomai/ChangeLog
--- xenomai/ChangeLog-ENOMEM	2006-09-03 10:14:22.000000000 +0200
+++ xenomai/ChangeLog	2006-09-03 14:43:39.000000000 +0200
@@ -1,3 +1,8 @@
+2006-09-03  Wolfgang Grandegger <[EMAIL PROTECTED]>
+
+	* ksrc/drivers/can/rtcan_dev.c (rtcan_dev_register): Bug fixed
+	when maximum number of devices is exeeded.
+
 2006-08-31  Gilles Chanteperdrix  <[EMAIL PROTECTED]>
 
 	* include/asm-generic/system.h (__xnlock_get): Simplify spinlocks
+ diff -u xenomai/ksrc/drivers/can/rtcan_dev.c-ENOMEM xenomai/ksrc/drivers/can/rtcan_dev.c
--- xenomai/ksrc/drivers/can/rtcan_dev.c-ENOMEM	2006-08-23 22:12:20.000000000 +0200
+++ xenomai/ksrc/drivers/can/rtcan_dev.c	2006-09-03 12:05:23.000000000 +0200
@@ -223,13 +223,17 @@
 int rtcan_dev_register(struct rtcan_device *dev)
 {
     rtdm_lockctx_t context;
-
+    int ret;
 
     down(&rtcan_devices_nrt_lock);
 
     rtcan_global_init();
 
-    dev->ifindex = __rtcan_dev_new_index();
+    if ((ret = __rtcan_dev_new_index()) < 0) {
+        up(&rtcan_devices_nrt_lock);
+        return ret;	
+    }
+    dev->ifindex = ret;
 
     if (strchr(dev->name,'%') != NULL)
         rtcan_dev_alloc_name(dev, dev->name);
_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to