unsigned int minor = MINOR(file_inode(file)->i_rdev);
        ssize_t retval;
        size_t image_size;
-       size_t okcount;
 
        if (minor == CONTROL_MINOR)
                return 0;
 
        /* Ensure not reading past end of the image */
        if (*ppos + count > image_size)
-               okcount = image_size - *ppos;
-       else
-               okcount = count;
+               count = image_size - *ppos;
 
        switch (type[minor]) {
        case MASTER_MINOR:
-               retval = resource_to_user(minor, buf, okcount, ppos);
+               retval = resource_to_user(minor, buf, count, ppos);
                break;
        case SLAVE_MINOR:
-               retval = buffer_to_user(minor, buf, okcount, ppos);
+               retval = buffer_to_user(minor, buf, count, ppos);
                break;
        default:
                retval = -EINVAL;
        unsigned int minor = MINOR(file_inode(file)->i_rdev);
        ssize_t retval;
        size_t image_size;
-       size_t okcount;
 
        if (minor == CONTROL_MINOR)
                return 0;
 
        /* Ensure not reading past end of the image */
        if (*ppos + count > image_size)
-               okcount = image_size - *ppos;
-       else
-               okcount = count;
+               count = image_size - *ppos;
 
        switch (type[minor]) {
        case MASTER_MINOR:
-               retval = resource_from_user(minor, buf, okcount, ppos);
+               retval = resource_from_user(minor, buf, count, ppos);
                break;
        case SLAVE_MINOR:
-               retval = buffer_from_user(minor, buf, okcount, ppos);
+               retval = buffer_from_user(minor, buf, count, ppos);
                break;
        default:
                retval = -EINVAL;