[libata] export ata_dev_pair; trim trailing whitespace
[linux-2.6-microblaze.git] / drivers / scsi / scsi_ioctl.c
index 6a3f6aa..36e9300 100644 (file)
@@ -122,13 +122,9 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd,
                                break;
                        }
                default:        /* Fall through for non-removable media */
-                       printk(KERN_INFO "ioctl_internal_command: <%d %d %d "
-                              "%d> return code = %x\n",
-                              sdev->host->host_no,
-                              sdev->channel,
-                              sdev->id,
-                              sdev->lun,
-                              result);
+                       sdev_printk(KERN_INFO, sdev,
+                                   "ioctl_internal_command return code = %x\n",
+                                   result);
                        scsi_print_sense_hdr("   ", &sshdr);
                        break;
                }
@@ -245,10 +241,9 @@ int scsi_ioctl_send_command(struct scsi_device *sdev,
                buf_needed = (buf_needed + 511) & ~511;
                if (buf_needed > MAX_BUF)
                        buf_needed = MAX_BUF;
-               buf = kmalloc(buf_needed, gfp_mask);
+               buf = kzalloc(buf_needed, gfp_mask);
                if (!buf)
                        return -ENOMEM;
-               memset(buf, 0, buf_needed);
                if (inlen == 0) {
                        data_direction = DMA_FROM_DEVICE;
                } else if (outlen == 0 ) {
@@ -282,7 +277,7 @@ int scsi_ioctl_send_command(struct scsi_device *sdev,
         * Obtain the data to be sent to the device (if any).
         */
 
-       if(copy_from_user(buf, cmd_in + cmdlen, inlen))
+       if(inlen && copy_from_user(buf, cmd_in + cmdlen, inlen))
                goto error;
 
        switch (opcode) {
@@ -326,7 +321,7 @@ int scsi_ioctl_send_command(struct scsi_device *sdev,
                if (copy_to_user(cmd_in, sense, sb_len))
                        result = -EFAULT;
        } else {
-               if (copy_to_user(cmd_in, buf, outlen))
+               if (outlen && copy_to_user(cmd_in, buf, outlen))
                        result = -EFAULT;
        }