From 9460a986e17d81ba6113fa2a396d086f60ce8d55 Mon Sep 17 00:00:00 2001 From: Martin Kepplinger Date: Thu, 29 Jun 2017 10:57:55 +0200 Subject: soc/amd/stoneyridge/northbridge.c: remove unnecessary null check Checking for NULL here doesn't help here. We *rely* on cdb_dev to exist directly before this check. Coverity had found this: *** CID 1376664: Null pointer dereferences (REVERSE_INULL) /src/soc/amd/stoneyridge/northbridge.c: 666 in cpu_bus_scan() 660 * this silicon. It is an SOC and can't have >= 16 APICs, but 661 * we will start numbering at 0x10. We also know there is only 662 * on physical node (module in AMD speak). 663 */ 664 665 lapicid_start = 0x10; /* Get this from devicetree? see comment above. */ CID 1376664: Null pointer dereferences (REVERSE_INULL) Null-checking "cdb_dev" suggests that it may be null, but it has already been dereferenced on all paths leading to the check. 666 enable_node = cdb_dev && cdb_dev->enabled; 667 cpu_bus = dev->link_list; 668 669 for (j = 0; j <= siblings; j++ ) { 670 apic_id = lapicid_start + j; 671 printk(BIOS_SPEW, "lapicid_start 0x%x, node 0x%x, core 0x%x, apicid=0x%x\n", Change-Id: Ic6a53df8b8d1596ad0eb1d8f0fa200cccf9509cf Signed-off-by: Martin Kepplinger Reviewed-on: https://review.coreboot.org/20415 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth --- src/soc/amd/stoneyridge/northbridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/soc/amd') diff --git a/src/soc/amd/stoneyridge/northbridge.c b/src/soc/amd/stoneyridge/northbridge.c index 009c6dfdbf..fac966fdde 100644 --- a/src/soc/amd/stoneyridge/northbridge.c +++ b/src/soc/amd/stoneyridge/northbridge.c @@ -676,7 +676,7 @@ void cpu_bus_scan(device_t dev) */ lapicid_start = 0x10; /* Get this from devicetree? see comment above. */ - enable_node = cdb_dev && cdb_dev->enabled; + enable_node = cdb_dev->enabled; cpu_bus = dev->link_list; for (j = 0 ; j <= siblings ; j++) { -- cgit v1.2.3