die() does never return. Annotate it as such. Any endless loop after die() can be eliminated. Dereferencing a NULL pointer is bad. die() instead. Replace endless loops with die().
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: LinuxBIOSv2-die/src/console/console.c =================================================================== --- LinuxBIOSv2-die/src/console/console.c (Revision 4339) +++ LinuxBIOSv2-die/src/console/console.c (Arbeitskopie) @@ -92,7 +92,7 @@ }
/* Report a fatal error */ -void die(const char *msg) +void __attribute__((noreturn)) die(const char *msg) { printk_emerg("%s", msg); post_code(0xff); Index: LinuxBIOSv2-die/src/devices/smbus_ops.c =================================================================== --- LinuxBIOSv2-die/src/devices/smbus_ops.c (Revision 4339) +++ LinuxBIOSv2-die/src/devices/smbus_ops.c (Arbeitskopie) @@ -34,7 +34,6 @@ if (!pbus || !pbus->dev || !pbus->dev->ops || !pbus->dev->ops->ops_smbus_bus) { printk_alert("%s Cannot find smbus bus operations", dev_path(dev)); die(""); - for(;;); } return pbus; } Index: LinuxBIOSv2-die/src/devices/pci_ops.c =================================================================== --- LinuxBIOSv2-die/src/devices/pci_ops.c (Revision 4339) +++ LinuxBIOSv2-die/src/devices/pci_ops.c (Arbeitskopie) @@ -30,7 +30,7 @@ struct bus *pbus;
if (!dev) - printk_alert("get_pbus: dev is NULL!\n"); + die("get_pbus: dev is NULL!\n");
pbus = dev->bus;
@@ -44,9 +44,8 @@ pbus = pbus->dev->bus; } if (!pbus || !pbus->dev || !pbus->dev->ops || !pbus->dev->ops->ops_pci_bus) { - printk_alert("%s Cannot find pci bus operations", dev_path(dev)); + printk_emerg("%s Cannot find pci bus operations\n", dev_path(dev)); die(""); - for(;;); } return pbus; } Index: LinuxBIOSv2-die/src/southbridge/intel/i82801dbm/i82801dbm_lpc.c =================================================================== --- LinuxBIOSv2-die/src/southbridge/intel/i82801dbm/i82801dbm_lpc.c (Revision 4339) +++ LinuxBIOSv2-die/src/southbridge/intel/i82801dbm/i82801dbm_lpc.c (Arbeitskopie) @@ -37,12 +37,12 @@ dword=*ioapic_sbd; printk_debug("Southbridge apic id = %x\n",dword); if(dword!=(2<<24)) - for(;;); + die(""); //lyh *ioapic_sba=3; //lyh dword=*ioapic_sbd; //lyh printk_debug("Southbridge apic DT = %x\n",dword); //lyh if(dword!=1) - //lyh for(;;); + //lyh die("");
}
Carl-Daniel Hailfinger wrote:
die() does never return. Annotate it as such. Any endless loop after die() can be eliminated. Dereferencing a NULL pointer is bad. die() instead. Replace endless loops with die().
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Acked-by: Peter Stuge peter@stuge.se
On 05.06.2009 13:35, Peter Stuge wrote:
Carl-Daniel Hailfinger wrote:
die() does never return. Annotate it as such. Any endless loop after die() can be eliminated. Dereferencing a NULL pointer is bad. die() instead. Replace endless loops with die().
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Acked-by: Peter Stuge peter@stuge.se
Thanks, committed in r4340.
Regards, Carl-Daniel
On Fri, Jun 05, 2009 at 01:19:34PM +0200, Carl-Daniel Hailfinger wrote:
printk_alert("%s Cannot find smbus bus operations", dev_path(dev)); die("");
Can we also make die() accept variable argument numbers so we can do this?
die("%s Cannot find smbus bus operations", dev_path(dev));
Or does this cause issues when die() is called very early (pre-RAM) or so?
Uwe.
On 05.06.2009 15:21, Uwe Hermann wrote:
On Fri, Jun 05, 2009 at 01:19:34PM +0200, Carl-Daniel Hailfinger wrote:
printk_alert("%s Cannot find smbus bus operations", dev_path(dev)); die("");
Can we also make die() accept variable argument numbers so we can do this?
I wanted to do that, but AFAICS it fails for early ROMCC compiled code.
die("%s Cannot find smbus bus operations", dev_path(dev));
Or does this cause issues when die() is called very early (pre-RAM) or so?
It sure would be desirable. Once the CBFS conversion goes as planned and Ron's conversion to v3 startup is done, converting boards to CAR should be doable and give us (among others) die() with parameters.
Regards, Carl-Daniel
On Fri, Jun 5, 2009 at 6:21 AM, Uwe Hermannuwe@hermann-uwe.de wrote:
On Fri, Jun 05, 2009 at 01:19:34PM +0200, Carl-Daniel Hailfinger wrote:
printk_alert("%s Cannot find smbus bus operations", dev_path(dev)); die("");
Can we also make die() accept variable argument numbers so we can do this?
die("%s Cannot find smbus bus operations", dev_path(dev));
Or does this cause issues when die() is called very early (pre-RAM) or so?
that's why it doesn't take variable arguments. You can not guarantee that it will always work.
ron