[OpenBIOS] [commit] r751 - in trunk/openbios-devel: drivers fs/hfsplus kernel libopenbios packages

repository service svn at openbios.org
Sun Apr 25 14:53:37 CEST 2010


Author: blueswirl
Date: Sun Apr 25 14:53:37 2010
New Revision: 751
URL: http://tracker.coreboot.org/trac/openbios/changeset/751

Log:
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 at gmail.com>

Modified:
   trunk/openbios-devel/drivers/ide.c
   trunk/openbios-devel/drivers/pci.c
   trunk/openbios-devel/fs/hfsplus/btree.c
   trunk/openbios-devel/fs/hfsplus/volume.c
   trunk/openbios-devel/kernel/dict.c
   trunk/openbios-devel/libopenbios/elf_info.c
   trunk/openbios-devel/libopenbios/elf_load.c
   trunk/openbios-devel/packages/cmdline.c
   trunk/openbios-devel/packages/video.c

Modified: trunk/openbios-devel/drivers/ide.c
==============================================================================
--- trunk/openbios-devel/drivers/ide.c	Sun Apr 25 14:53:32 2010	(r750)
+++ trunk/openbios-devel/drivers/ide.c	Sun Apr 25 14:53:37 2010	(r751)
@@ -196,8 +196,10 @@
 static void
 ob_ide_error(struct ide_drive *drive, unsigned char stat, const char *msg)
 {
+#ifdef CONFIG_DEBUG_IDE
 	struct ide_channel *chan = drive->channel;
 	unsigned char err;
+#endif
 
 	if (!stat)
 		stat = ob_ide_pio_readb(drive, IDEREG_STATUS);
@@ -206,11 +208,15 @@
 	IDE_DPRINTF("    cmd=%x, stat=%x", chan->ata_cmd.command, 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("\n");
 
+#ifdef CONFIG_DEBUG_IDE
 	/*
 	 * see if sense is valid and dump that
 	 */
@@ -237,6 +243,7 @@
 			IDE_DPRINTF(", no sense");
 		IDE_DPRINTF("\n");
 	}
+#endif
 }
 
 /*

Modified: trunk/openbios-devel/drivers/pci.c
==============================================================================
--- trunk/openbios-devel/drivers/pci.c	Sun Apr 25 14:53:32 2010	(r750)
+++ trunk/openbios-devel/drivers/pci.c	Sun Apr 25 14:53:37 2010	(r751)
@@ -97,10 +97,8 @@
 	int bus = 0;		/* no information */
 	char *ptr;
 
-	dev = 0;
 	fn = 0;
 	reg = 0;
-	ss = 0;
 	n = 0;
 	p = 0;
 	t = 0;
@@ -202,14 +200,13 @@
 	cell hi = POP();
 	cell mid = 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;
 	p = hi & IS_PREFETCHABLE;
 	t = hi & IS_ALIASED;
 	ss = (hi >> 24) & 0x03;
 
-	bus = (hi >> 16) & 0xFF;
 	dev = (hi >> 11) & 0x1F;
 	fn = (hi >> 8) & 0x07;
 	reg = hi & 0xFF;
@@ -928,7 +925,7 @@
 	pci_config_t config;
         const pci_dev_t *pci_dev;
 	uint32_t ccode;
-	uint8_t class, subclass, iface, rev;
+        uint8_t class, subclass, iface;
 	int num_bars, rom_bar;
 
 	activate_device("/");
@@ -950,7 +947,6 @@
 			class = ccode >> 8;
 			subclass = ccode;
 			iface = pci_config_read8(addr, PCI_CLASS_PROG);
-			rev = pci_config_read8(addr, PCI_REVISION_ID);
 
 			pci_dev = pci_find_device(class, subclass, iface,
 						  vid, did);

Modified: trunk/openbios-devel/fs/hfsplus/btree.c
==============================================================================
--- trunk/openbios-devel/fs/hfsplus/btree.c	Sun Apr 25 14:53:32 2010	(r750)
+++ trunk/openbios-devel/fs/hfsplus/btree.c	Sun Apr 25 14:53:37 2010	(r751)
@@ -226,7 +226,7 @@
     p = btree_readnode(&node, p);
     if (node.kind != HFSP_NODE_HEAD)
 	return -1;   // should not happen ?
-    p = btree_readhead(&bt->head, p);
+    btree_readhead(&bt->head, p);
 
     node_size = bt->head.node_size;
     bt->blkpernode = node_size / vol->blksize;

Modified: trunk/openbios-devel/fs/hfsplus/volume.c
==============================================================================
--- trunk/openbios-devel/fs/hfsplus/volume.c	Sun Apr 25 14:53:32 2010	(r750)
+++ trunk/openbios-devel/fs/hfsplus/volume.c	Sun Apr 25 14:53:37 2010	(r751)
@@ -146,7 +146,7 @@
 	p = volume_readfork(p, &vh->ext_file   );
 	p = volume_readfork(p, &vh->cat_file   );
 	p = volume_readfork(p, &vh->attr_file  );
-	p = volume_readfork(p, &vh->start_file );
+        volume_readfork(p, &vh->start_file );
 	return 0;
   fail:
 	return -1;

Modified: trunk/openbios-devel/kernel/dict.c
==============================================================================
--- trunk/openbios-devel/kernel/dict.c	Sun Apr 25 14:53:32 2010	(r750)
+++ trunk/openbios-devel/kernel/dict.c	Sun Apr 25 14:53:37 2010	(r751)
@@ -286,7 +286,6 @@
 	}
 
 	data += sizeof(dictionary_header_t);
-	len -= sizeof(dictionary_header_t);
 
 	dicthead = target_long(header->length);
 

Modified: trunk/openbios-devel/libopenbios/elf_info.c
==============================================================================
--- trunk/openbios-devel/libopenbios/elf_info.c	Sun Apr 25 14:53:32 2010	(r750)
+++ trunk/openbios-devel/libopenbios/elf_info.c	Sun Apr 25 14:53:37 2010	(r751)
@@ -103,7 +103,7 @@
     Elf_Bhdr *hdr = NULL;
     char *addr, *end;
     Elf_Nhdr *nhdr;
-    char *name, *desc;
+    char *desc;
 
     if (info->boot_type == ELF_BHDR_MAGIC)
 	hdr = phys_to_virt(info->boot_data);
@@ -123,7 +123,6 @@
     while (addr <  end) {
 	nhdr = (Elf_Nhdr *) addr;
 	addr += sizeof(Elf_Nhdr);
-	name = addr;
 	addr += (nhdr->n_namesz + 3) & ~3;
 	desc = addr;
 	addr += (nhdr->n_descsz + 3) & ~3;

Modified: trunk/openbios-devel/libopenbios/elf_load.c
==============================================================================
--- trunk/openbios-devel/libopenbios/elf_load.c	Sun Apr 25 14:53:32 2010	(r750)
+++ trunk/openbios-devel/libopenbios/elf_load.c	Sun Apr 25 14:53:37 2010	(r751)
@@ -274,7 +274,6 @@
     addr += nhdr.n_descsz;
     pad = padded(nhdr.n_descsz) - nhdr.n_descsz;
     memset(addr, 0, pad);
-    addr += pad;
 
     bhdr->b_size += ent_size;
     bhdr->b_records++;

Modified: trunk/openbios-devel/packages/cmdline.c
==============================================================================
--- trunk/openbios-devel/packages/cmdline.c	Sun Apr 25 14:53:32 2010	(r750)
+++ trunk/openbios-devel/packages/cmdline.c	Sun Apr 25 14:53:37 2010	(r751)
@@ -178,7 +178,7 @@
 cmdline_prompt( cmdline_info_t *ci )
 {
 	int cur_added=0, histind=0, ch, i, pos=0, n=0, prompt=1;
-	char *buf = ci->buf;
+        char *buf;
 	int terminate = 0;
 
 	buf = ci->buf;

Modified: trunk/openbios-devel/packages/video.c
==============================================================================
--- trunk/openbios-devel/packages/video.c	Sun Apr 25 14:53:32 2010	(r750)
+++ trunk/openbios-devel/packages/video.c	Sun Apr 25 14:53:37 2010	(r751)
@@ -308,7 +308,10 @@
 void
 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;
 
 	video.fb.mphys = fb;
@@ -326,11 +329,10 @@
 	video.has_video = 1;
 	video.pal = malloc( 256 * sizeof(ulong) );
 
-	s = (video.fb.mphys & 0xfff);
-	size = ((video.fb.h * video.fb.rb + s) + 0xfff) & ~0xfff;
-	s = video.fb.mphys - s;
-
 #ifdef CONFIG_PPC
+        s = (video.fb.mphys & 0xfff);
+        size = ((video.fb.h * video.fb.rb + s) + 0xfff) & ~0xfff;
+
 	ofmem_claim_phys( video.fb.mphys, size, 0 );
 	ofmem_claim_virt( video.fb.mphys, size, 0 );
 	ofmem_map( video.fb.mphys, video.fb.mphys, size, -1 );



More information about the OpenBIOS mailing list