ath5k: fix NULL pointer in antenna configuration
[safe/jmp/linux-2.6] / drivers / rapidio / rio-sysfs.c
index 5687b8f..ba742e8 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/rio.h>
 #include <linux/rio_drv.h>
 #include <linux/stat.h>
-#include <linux/sched.h>       /* for capable() */
 
 #include "rio.h"
 
@@ -44,7 +43,8 @@ static ssize_t routes_show(struct device *dev, struct device_attribute *attr, ch
        if (!rdev->rswitch)
                goto out;
 
-       for (i = 0; i < RIO_MAX_ROUTE_ENTRIES; i++) {
+       for (i = 0; i < RIO_MAX_ROUTE_ENTRIES(rdev->net->hport->sys_size);
+                       i++) {
                if (rdev->rswitch->route_table[i] == RIO_INVALID_ROUTE)
                        continue;
                str +=
@@ -68,7 +68,8 @@ struct device_attribute rio_dev_attrs[] = {
 };
 
 static ssize_t
-rio_read_config(struct kobject *kobj, char *buf, loff_t off, size_t count)
+rio_read_config(struct kobject *kobj, struct bin_attribute *bin_attr,
+               char *buf, loff_t off, size_t count)
 {
        struct rio_dev *dev =
            to_rio_dev(container_of(kobj, struct device, kobj));
@@ -138,7 +139,8 @@ rio_read_config(struct kobject *kobj, char *buf, loff_t off, size_t count)
 }
 
 static ssize_t
-rio_write_config(struct kobject *kobj, char *buf, loff_t off, size_t count)
+rio_write_config(struct kobject *kobj, struct bin_attribute *bin_attr,
+                char *buf, loff_t off, size_t count)
 {
        struct rio_dev *dev =
            to_rio_dev(container_of(kobj, struct device, kobj));
@@ -198,7 +200,6 @@ static struct bin_attribute rio_config_attr = {
        .attr = {
                 .name = "config",
                 .mode = S_IRUGO | S_IWUSR,
-                .owner = THIS_MODULE,
                 },
        .size = 0x200000,
        .read = rio_read_config,
@@ -213,9 +214,11 @@ static struct bin_attribute rio_config_attr = {
  */
 int rio_create_sysfs_dev_files(struct rio_dev *rdev)
 {
-       sysfs_create_bin_file(&rdev->dev.kobj, &rio_config_attr);
+       int err = 0;
 
-       return 0;
+       err = sysfs_create_bin_file(&rdev->dev.kobj, &rio_config_attr);
+
+       return err;
 }
 
 /**