Merge to Fedora kernel-2.6.7-1.492
[linux-2.6.git] / drivers / s390 / scsi / zfcp_aux.c
index 4f4fd5a..939bbad 100644 (file)
@@ -29,7 +29,7 @@
  */
 
 /* this drivers version (do not edit !!! generated and updated by cvs) */
-#define ZFCP_AUX_REVISION "$Revision: 1.108 $"
+#define ZFCP_AUX_REVISION "$Revision: 1.114 $"
 
 #include "zfcp_ext.h"
 
@@ -310,6 +310,10 @@ zfcp_module_init(void)
        /* initialize adapters to be removed list head */
        INIT_LIST_HEAD(&zfcp_data.adapter_remove_lh);
 
+       zfcp_transport_template = fc_attach_transport(&zfcp_transport_functions);
+       if (!zfcp_transport_template)
+               return -ENODEV;
+
 #ifdef CONFIG_S390_SUPPORT
        retval = register_ioctl32_conversion(zfcp_ioctl_trans.cmd,
                                             zfcp_ioctl_trans.handler);
@@ -414,7 +418,7 @@ zfcp_cfdc_dev_ioctl(struct inode *inode, struct file *file,
                retval = -ENOMEM;
                goto out;
        }
-       sg_list->count = 0;
+       memset(sg_list, 0, sizeof(*sg_list));
 
        if (command != ZFCP_CFDC_IOC) {
                ZFCP_LOG_INFO("IOC request code 0x%x invalid\n", command);
@@ -599,6 +603,7 @@ zfcp_sg_list_alloc(struct zfcp_sg_list *sg_list, size_t size)
        sg_list->sg = kmalloc(sg_list->count * sizeof(struct scatterlist),
                              GFP_KERNEL);
        if (sg_list->sg == NULL) {
+               sg_list->count = 0;
                retval = -ENOMEM;
                goto out;
        }
@@ -635,11 +640,13 @@ zfcp_sg_list_free(struct zfcp_sg_list *sg_list)
        unsigned int i;
        int retval = 0;
 
-       BUG_ON((sg_list->sg == NULL) || (sg_list == NULL));
+       BUG_ON(sg_list == NULL);
 
        for (i = 0, sg = sg_list->sg; i < sg_list->count; i++, sg++)
                __free_pages(sg->page, 0);
 
+       kfree(sg_list->sg);
+
        return retval;
 }