| File: | obj-scan-build/../linux/src/drivers/scsi/eata_pio_proc.c |
| Location: | line 89, column 5 |
| Description: | Value stored to 'pos' is never read |
| 1 | |
| 2 | /* |
| 3 | * eata_set_info |
| 4 | * buffer : pointer to the data that has been written to the hostfile |
| 5 | * length : number of bytes written to the hostfile |
| 6 | * HBA_ptr: pointer to the Scsi_Host struct |
| 7 | */ |
| 8 | int eata_pio_set_info(char *buffer, int length, struct Scsi_Host *HBA_ptr) |
| 9 | { |
| 10 | DBG(DBG_PROC_WRITE, printk("%s\n", buffer))if ((0)) {printk("%s\n", buffer);}; |
| 11 | return(-ENOSYS38); /* Currently this is a no-op */ |
| 12 | } |
| 13 | |
| 14 | /* |
| 15 | * eata_proc_info |
| 16 | * inout : decides on the direction of the dataflow and the meaning of the |
| 17 | * variables |
| 18 | * buffer: If inout==FALSE data is being written to it else read from it |
| 19 | * *start: If inout==FALSE start of the valid data in the buffer |
| 20 | * offset: If inout==FALSE offset from the beginning of the imaginary file |
| 21 | * from which we start writing into the buffer |
| 22 | * length: If inout==FALSE max number of bytes to be written into the buffer |
| 23 | * else number of bytes in the buffer |
| 24 | */ |
| 25 | int eata_pio_proc_info(char *buffer, char **start, off_t offset, int length, |
| 26 | int hostno, int inout) |
| 27 | { |
| 28 | |
| 29 | Scsi_Device *scd; |
| 30 | struct Scsi_Host *HBA_ptr; |
| 31 | static u8 buff[512]; |
| 32 | int i; |
| 33 | int size, len = 0; |
| 34 | off_t begin = 0; |
| 35 | off_t pos = 0; |
| 36 | |
| 37 | HBA_ptr = first_HBA; |
| 38 | for (i = 1; i <= registered_HBAs; i++) { |
| 39 | if (HBA_ptr->host_no == hostno) |
| 40 | break; |
| 41 | HBA_ptr = SD(HBA_ptr)((hostdata *)&(HBA_ptr->hostdata))->next; |
| 42 | } |
| 43 | |
| 44 | if(inout == TRUE1) /* Has data been written to the file ? */ |
| 45 | return(eata_pio_set_info(buffer, length, HBA_ptr)); |
| 46 | |
| 47 | if (offset == 0) |
| 48 | memset(buff, 0, sizeof(buff))(__builtin_constant_p(0) ? (__builtin_constant_p((sizeof(buff ))) ? __constant_c_and_count_memset(((buff)),((0x01010101UL*( unsigned char)(0))),((sizeof(buff)))) : __constant_c_memset(( (buff)),((0x01010101UL*(unsigned char)(0))),((sizeof(buff)))) ) : (__builtin_constant_p((sizeof(buff))) ? __memset_generic( (((buff))),(((0))),(((sizeof(buff))))) : __memset_generic(((buff )),((0)),((sizeof(buff)))))); |
| 49 | |
| 50 | size = sprintflinux_sprintf(buffer+len, "EATA (Extended Attachment) PIO driver version: " |
| 51 | "%d.%d%s\n",VER_MAJOR0, VER_MINOR0, VER_SUB"1b"); |
| 52 | len += size; pos = begin + len; |
| 53 | size = sprintflinux_sprintf(buffer + len, "queued commands: %10ld\n" |
| 54 | "processed interrupts:%10ld\n", queue_counter, int_counter); |
| 55 | len += size; pos = begin + len; |
| 56 | |
| 57 | size = sprintflinux_sprintf(buffer + len, "\nscsi%-2d: HBA %.10s\n", |
| 58 | HBA_ptr->host_no, SD(HBA_ptr)((hostdata *)&(HBA_ptr->hostdata))->name); |
| 59 | len += size; |
| 60 | pos = begin + len; |
| 61 | size = sprintflinux_sprintf(buffer + len, "Firmware revision: v%s\n", |
| 62 | SD(HBA_ptr)((hostdata *)&(HBA_ptr->hostdata))->revision); |
| 63 | len += size; |
| 64 | pos = begin + len; |
| 65 | size = sprintflinux_sprintf(buffer + len, "IO: PIO\n"); |
| 66 | len += size; |
| 67 | pos = begin + len; |
| 68 | size = sprintflinux_sprintf(buffer + len, "Base IO : %#.4x\n", (u32) HBA_ptr->base); |
| 69 | len += size; |
| 70 | pos = begin + len; |
| 71 | size = sprintflinux_sprintf(buffer + len, "Host Bus: %s\n", |
| 72 | (SD(HBA_ptr)((hostdata *)&(HBA_ptr->hostdata))->bustype == 'P')?"PCI ": |
| 73 | (SD(HBA_ptr)((hostdata *)&(HBA_ptr->hostdata))->bustype == 'E')?"EISA":"ISA "); |
| 74 | |
| 75 | len += size; |
| 76 | pos = begin + len; |
| 77 | |
| 78 | if (pos < offset) { |
| 79 | len = 0; |
| 80 | begin = pos; |
| 81 | } |
| 82 | if (pos > offset + length) |
| 83 | goto stop_output; |
| 84 | |
| 85 | scd = scsi_devices; |
| 86 | |
| 87 | size = sprintflinux_sprintf(buffer+len,"Attached devices: %s\n", (scd)?"":"none"); |
| 88 | len += size; |
| 89 | pos = begin + len; |
Value stored to 'pos' is never read | |
| 90 | |
| 91 | while (scd) { |
| 92 | if (scd->host == HBA_ptr) { |
| 93 | proc_print_scsidevice(scd, buffer, &size, len); |
| 94 | len += size; |
| 95 | pos = begin + len; |
| 96 | |
| 97 | if (pos < offset) { |
| 98 | len = 0; |
| 99 | begin = pos; |
| 100 | } |
| 101 | if (pos > offset + length) |
| 102 | goto stop_output; |
| 103 | } |
| 104 | scd = scd->next; |
| 105 | } |
| 106 | |
| 107 | stop_output: |
| 108 | DBG(DBG_PROC, printk("2pos: %ld offset: %ld len: %d\n", pos, offset, len))if ((0)) {printk("2pos: %ld offset: %ld len: %d\n", pos, offset , len);}; |
| 109 | *start=buffer+(offset-begin); /* Start of wanted data */ |
| 110 | len-=(offset-begin); /* Start slop */ |
| 111 | if(len>length) |
| 112 | len = length; /* Ending slop */ |
| 113 | DBG(DBG_PROC, printk("3pos: %ld offset: %ld len: %d\n", pos, offset, len))if ((0)) {printk("3pos: %ld offset: %ld len: %d\n", pos, offset , len);}; |
| 114 | |
| 115 | return (len); |
| 116 | } |
| 117 | |
| 118 | /* |
| 119 | * Overrides for Emacs so that we follow Linus's tabbing style. |
| 120 | * Emacs will notice this stuff at the end of the file and automatically |
| 121 | * adjust the settings for this buffer only. This must remain at the end |
| 122 | * of the file. |
| 123 | * --------------------------------------------------------------------------- |
| 124 | * Local variables: |
| 125 | * c-indent-level: 4 |
| 126 | * c-brace-imaginary-offset: 0 |
| 127 | * c-brace-offset: -4 |
| 128 | * c-argdecl-indent: 4 |
| 129 | * c-label-offset: -4 |
| 130 | * c-continued-statement-offset: 4 |
| 131 | * c-continued-brace-offset: 0 |
| 132 | * tab-width: 8 |
| 133 | * End: |
| 134 | */ |
| 135 |