static int p_fill_from_dev_buffer(struct scsi_cmnd *scp, const void *arr,
                                  int arr_len, unsigned int off_dst)
 {
-       int act_len, n;
+       unsigned int act_len, n;
        struct scsi_data_buffer *sdb = &scp->sdb;
        off_t skip = off_dst;
 
        pr_debug("%s: off_dst=%u, scsi_bufflen=%u, act_len=%u, resid=%d\n",
                 __func__, off_dst, scsi_bufflen(scp), act_len,
                 scsi_get_resid(scp));
-       n = (int)scsi_bufflen(scp) - ((int)off_dst + act_len);
+       n = scsi_bufflen(scp) - (off_dst + act_len);
        scsi_set_resid(scp, min(scsi_get_resid(scp), n));
        return 0;
 }
 
                residue = min(residue, transfer_length);
                if (us->srb != NULL)
                        scsi_set_resid(us->srb, max(scsi_get_resid(us->srb),
-                                                               (int)residue));
+                                                               residue));
        }
 
        if (bcs->Status != US_BULK_STAT_OK)
 
 
                } else {
                        residue = min(residue, transfer_length);
-                       scsi_set_resid(srb, max(scsi_get_resid(srb),
-                                                              (int) residue));
+                       scsi_set_resid(srb, max(scsi_get_resid(srb), residue));
                }
        }
 
 
        return cmd->sdb.length;
 }
 
-static inline void scsi_set_resid(struct scsi_cmnd *cmd, int resid)
+static inline void scsi_set_resid(struct scsi_cmnd *cmd, unsigned int resid)
 {
        cmd->req.resid_len = resid;
 }
 
-static inline int scsi_get_resid(struct scsi_cmnd *cmd)
+static inline unsigned int scsi_get_resid(struct scsi_cmnd *cmd)
 {
        return cmd->req.resid_len;
 }