mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
Fix dead variable assignment, spotted by clang analyzer
Fix clang warnings:
../kernel/dict.c:289:2: warning: Value stored to 'len' is never read
len -= sizeof(dictionary_header_t);
../packages/cmdline.c:181:8: warning: Value stored to 'buf' during its
initialization is never read
char *buf = ci->buf;
../libopenbios/elf_info.c:126:2: warning: Value stored to 'name' is never read
name = addr;
../libopenbios/elf_load.c:277:5: warning: Value stored to 'addr' is never read
addr += pad;
../drivers/ide.c:209:3: warning: Value stored to 'err' is never read
err = ob_ide_pio_readb(drive, IDEREG_ERROR);
../drivers/ide.c:219:17: warning: Value stored to 'old_cdb' during its initialization is never read
unsigned char old_cdb = cmd->cdb[0];
../drivers/ide.c:222:4: warning: Value stored to 'old_cdb' is never read
old_cdb = cmd->old_cdb;
../drivers/pci.c:103:2: warning: Value stored to 'ss' is never read
ss = 0;
../drivers/pci.c:100:2: warning: Value stored to 'dev' is never read
dev = 0;
../drivers/pci.c:212:2: warning: Value stored to 'bus' is never read
bus = (hi >> 16) & 0xFF;
../drivers/pci.c:953:4: warning: Value stored to 'rev' is never read
rev = pci_config_read8(addr, PCI_REVISION_ID);
../packages/video.c:331:2: warning: Value stored to 's' is never read
s = video.fb.mphys - s;
../packages/video.c:330:2: warning: Value stored to 'size' is never read
size = ((video.fb.h * video.fb.rb + s) + 0xfff) & ~0xfff;
../fs/hfsplus/btree.c:229:5: warning: Value stored to 'p' is never read
p = btree_readhead(&bt->head, p);
../fs/hfsplus/volume.c:149:2: warning: Value stored to 'p' is never read
p = volume_readfork(p, &vh->start_file );
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@751 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
@@ -196,8 +196,10 @@ ob_ide_400ns_delay(struct ide_drive *drive)
|
|||||||
static void
|
static void
|
||||||
ob_ide_error(struct ide_drive *drive, unsigned char stat, const char *msg)
|
ob_ide_error(struct ide_drive *drive, unsigned char stat, const char *msg)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_DEBUG_IDE
|
||||||
struct ide_channel *chan = drive->channel;
|
struct ide_channel *chan = drive->channel;
|
||||||
unsigned char err;
|
unsigned char err;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!stat)
|
if (!stat)
|
||||||
stat = ob_ide_pio_readb(drive, IDEREG_STATUS);
|
stat = ob_ide_pio_readb(drive, IDEREG_STATUS);
|
||||||
@@ -206,11 +208,15 @@ ob_ide_error(struct ide_drive *drive, unsigned char stat, const char *msg)
|
|||||||
IDE_DPRINTF(" cmd=%x, stat=%x", chan->ata_cmd.command, stat);
|
IDE_DPRINTF(" cmd=%x, stat=%x", chan->ata_cmd.command, stat);
|
||||||
|
|
||||||
if ((stat & (BUSY_STAT | ERR_STAT)) == ERR_STAT) {
|
if ((stat & (BUSY_STAT | ERR_STAT)) == ERR_STAT) {
|
||||||
err = ob_ide_pio_readb(drive, IDEREG_ERROR);
|
#ifdef CONFIG_DEBUG_IDE
|
||||||
|
err =
|
||||||
|
#endif
|
||||||
|
ob_ide_pio_readb(drive, IDEREG_ERROR);
|
||||||
IDE_DPRINTF(", err=%x", err);
|
IDE_DPRINTF(", err=%x", err);
|
||||||
}
|
}
|
||||||
IDE_DPRINTF("\n");
|
IDE_DPRINTF("\n");
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_IDE
|
||||||
/*
|
/*
|
||||||
* see if sense is valid and dump that
|
* see if sense is valid and dump that
|
||||||
*/
|
*/
|
||||||
@@ -237,6 +243,7 @@ ob_ide_error(struct ide_drive *drive, unsigned char stat, const char *msg)
|
|||||||
IDE_DPRINTF(", no sense");
|
IDE_DPRINTF(", no sense");
|
||||||
IDE_DPRINTF("\n");
|
IDE_DPRINTF("\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -97,10 +97,8 @@ ob_pci_decode_unit(int *idx)
|
|||||||
int bus = 0; /* no information */
|
int bus = 0; /* no information */
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
dev = 0;
|
|
||||||
fn = 0;
|
fn = 0;
|
||||||
reg = 0;
|
reg = 0;
|
||||||
ss = 0;
|
|
||||||
n = 0;
|
n = 0;
|
||||||
p = 0;
|
p = 0;
|
||||||
t = 0;
|
t = 0;
|
||||||
@@ -202,14 +200,13 @@ ob_pci_encode_unit(int *idx)
|
|||||||
cell hi = POP();
|
cell hi = POP();
|
||||||
cell mid = POP();
|
cell mid = POP();
|
||||||
cell lo = POP();
|
cell lo = POP();
|
||||||
int n, p, t, ss, bus, dev, fn, reg;
|
int n, p, t, ss, dev, fn, reg;
|
||||||
|
|
||||||
n = hi & IS_NOT_RELOCATABLE;
|
n = hi & IS_NOT_RELOCATABLE;
|
||||||
p = hi & IS_PREFETCHABLE;
|
p = hi & IS_PREFETCHABLE;
|
||||||
t = hi & IS_ALIASED;
|
t = hi & IS_ALIASED;
|
||||||
ss = (hi >> 24) & 0x03;
|
ss = (hi >> 24) & 0x03;
|
||||||
|
|
||||||
bus = (hi >> 16) & 0xFF;
|
|
||||||
dev = (hi >> 11) & 0x1F;
|
dev = (hi >> 11) & 0x1F;
|
||||||
fn = (hi >> 8) & 0x07;
|
fn = (hi >> 8) & 0x07;
|
||||||
reg = hi & 0xFF;
|
reg = hi & 0xFF;
|
||||||
@@ -928,7 +925,7 @@ static void ob_scan_pci_bus(int bus, unsigned long *mem_base,
|
|||||||
pci_config_t config;
|
pci_config_t config;
|
||||||
const pci_dev_t *pci_dev;
|
const pci_dev_t *pci_dev;
|
||||||
uint32_t ccode;
|
uint32_t ccode;
|
||||||
uint8_t class, subclass, iface, rev;
|
uint8_t class, subclass, iface;
|
||||||
int num_bars, rom_bar;
|
int num_bars, rom_bar;
|
||||||
|
|
||||||
activate_device("/");
|
activate_device("/");
|
||||||
@@ -950,7 +947,6 @@ static void ob_scan_pci_bus(int bus, unsigned long *mem_base,
|
|||||||
class = ccode >> 8;
|
class = ccode >> 8;
|
||||||
subclass = ccode;
|
subclass = ccode;
|
||||||
iface = pci_config_read8(addr, PCI_CLASS_PROG);
|
iface = pci_config_read8(addr, PCI_CLASS_PROG);
|
||||||
rev = pci_config_read8(addr, PCI_REVISION_ID);
|
|
||||||
|
|
||||||
pci_dev = pci_find_device(class, subclass, iface,
|
pci_dev = pci_find_device(class, subclass, iface,
|
||||||
vid, did);
|
vid, did);
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ static int btree_init(btree* bt, volume* vol, hfsp_fork_raw* fork)
|
|||||||
p = btree_readnode(&node, p);
|
p = btree_readnode(&node, p);
|
||||||
if (node.kind != HFSP_NODE_HEAD)
|
if (node.kind != HFSP_NODE_HEAD)
|
||||||
return -1; // should not happen ?
|
return -1; // should not happen ?
|
||||||
p = btree_readhead(&bt->head, p);
|
btree_readhead(&bt->head, p);
|
||||||
|
|
||||||
node_size = bt->head.node_size;
|
node_size = bt->head.node_size;
|
||||||
bt->blkpernode = node_size / vol->blksize;
|
bt->blkpernode = node_size / vol->blksize;
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ volume_readbuf(hfsp_vh* vh, char * p)
|
|||||||
p = volume_readfork(p, &vh->ext_file );
|
p = volume_readfork(p, &vh->ext_file );
|
||||||
p = volume_readfork(p, &vh->cat_file );
|
p = volume_readfork(p, &vh->cat_file );
|
||||||
p = volume_readfork(p, &vh->attr_file );
|
p = volume_readfork(p, &vh->attr_file );
|
||||||
p = volume_readfork(p, &vh->start_file );
|
volume_readfork(p, &vh->start_file );
|
||||||
return 0;
|
return 0;
|
||||||
fail:
|
fail:
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -286,7 +286,6 @@ ucell load_dictionary(const char *data, ucell len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
data += sizeof(dictionary_header_t);
|
data += sizeof(dictionary_header_t);
|
||||||
len -= sizeof(dictionary_header_t);
|
|
||||||
|
|
||||||
dicthead = target_long(header->length);
|
dicthead = target_long(header->length);
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ void collect_elfboot_info(struct sys_info *info)
|
|||||||
Elf_Bhdr *hdr = NULL;
|
Elf_Bhdr *hdr = NULL;
|
||||||
char *addr, *end;
|
char *addr, *end;
|
||||||
Elf_Nhdr *nhdr;
|
Elf_Nhdr *nhdr;
|
||||||
char *name, *desc;
|
char *desc;
|
||||||
|
|
||||||
if (info->boot_type == ELF_BHDR_MAGIC)
|
if (info->boot_type == ELF_BHDR_MAGIC)
|
||||||
hdr = phys_to_virt(info->boot_data);
|
hdr = phys_to_virt(info->boot_data);
|
||||||
@@ -123,7 +123,6 @@ void collect_elfboot_info(struct sys_info *info)
|
|||||||
while (addr < end) {
|
while (addr < end) {
|
||||||
nhdr = (Elf_Nhdr *) addr;
|
nhdr = (Elf_Nhdr *) addr;
|
||||||
addr += sizeof(Elf_Nhdr);
|
addr += sizeof(Elf_Nhdr);
|
||||||
name = addr;
|
|
||||||
addr += (nhdr->n_namesz + 3) & ~3;
|
addr += (nhdr->n_namesz + 3) & ~3;
|
||||||
desc = addr;
|
desc = addr;
|
||||||
addr += (nhdr->n_descsz + 3) & ~3;
|
addr += (nhdr->n_descsz + 3) & ~3;
|
||||||
|
|||||||
@@ -274,7 +274,6 @@ static Elf_Bhdr *add_boot_note(Elf_Bhdr *bhdr, const char *name,
|
|||||||
addr += nhdr.n_descsz;
|
addr += nhdr.n_descsz;
|
||||||
pad = padded(nhdr.n_descsz) - nhdr.n_descsz;
|
pad = padded(nhdr.n_descsz) - nhdr.n_descsz;
|
||||||
memset(addr, 0, pad);
|
memset(addr, 0, pad);
|
||||||
addr += pad;
|
|
||||||
|
|
||||||
bhdr->b_size += ent_size;
|
bhdr->b_size += ent_size;
|
||||||
bhdr->b_records++;
|
bhdr->b_records++;
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ static void /* ( -- ) */
|
|||||||
cmdline_prompt( cmdline_info_t *ci )
|
cmdline_prompt( cmdline_info_t *ci )
|
||||||
{
|
{
|
||||||
int cur_added=0, histind=0, ch, i, pos=0, n=0, prompt=1;
|
int cur_added=0, histind=0, ch, i, pos=0, n=0, prompt=1;
|
||||||
char *buf = ci->buf;
|
char *buf;
|
||||||
int terminate = 0;
|
int terminate = 0;
|
||||||
|
|
||||||
buf = ci->buf;
|
buf = ci->buf;
|
||||||
|
|||||||
@@ -308,7 +308,10 @@ NODE_METHODS( video ) = {
|
|||||||
void
|
void
|
||||||
init_video( unsigned long fb, int width, int height, int depth, int rb )
|
init_video( unsigned long fb, int width, int height, int depth, int rb )
|
||||||
{
|
{
|
||||||
int i, s, size;
|
int i;
|
||||||
|
#ifdef CONFIG_PPC
|
||||||
|
int s, size;
|
||||||
|
#endif
|
||||||
phandle_t ph=0;
|
phandle_t ph=0;
|
||||||
|
|
||||||
video.fb.mphys = fb;
|
video.fb.mphys = fb;
|
||||||
@@ -326,11 +329,10 @@ init_video( unsigned long fb, int width, int height, int depth, int rb )
|
|||||||
video.has_video = 1;
|
video.has_video = 1;
|
||||||
video.pal = malloc( 256 * sizeof(ulong) );
|
video.pal = malloc( 256 * sizeof(ulong) );
|
||||||
|
|
||||||
|
#ifdef CONFIG_PPC
|
||||||
s = (video.fb.mphys & 0xfff);
|
s = (video.fb.mphys & 0xfff);
|
||||||
size = ((video.fb.h * video.fb.rb + s) + 0xfff) & ~0xfff;
|
size = ((video.fb.h * video.fb.rb + s) + 0xfff) & ~0xfff;
|
||||||
s = video.fb.mphys - s;
|
|
||||||
|
|
||||||
#ifdef CONFIG_PPC
|
|
||||||
ofmem_claim_phys( video.fb.mphys, size, 0 );
|
ofmem_claim_phys( video.fb.mphys, size, 0 );
|
||||||
ofmem_claim_virt( video.fb.mphys, size, 0 );
|
ofmem_claim_virt( video.fb.mphys, size, 0 );
|
||||||
ofmem_map( video.fb.mphys, video.fb.mphys, size, -1 );
|
ofmem_map( video.fb.mphys, video.fb.mphys, size, -1 );
|
||||||
|
|||||||
Reference in New Issue
Block a user