superio/common: Avoid NULL pointer dereference

Coverity detects dereferencing a pointer that might be "NULL" when
calling report_resource_stored. Add sanity check for dev to prevent
NULL pointer dereference.

Found-by: Coverity CID 1419488

Signed-off-by: John Zhao <john.zhao@intel.com>
Change-Id: I03efad87ba761e914b47e3294c646335cfbaed24
Reviewed-on: https://review.coreboot.org/c/coreboot/+/43553
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
John Zhao 2020-07-17 09:09:56 -07:00 committed by Felix Held
parent 7f107b472a
commit 9857c90685
1 changed files with 3 additions and 0 deletions

View File

@ -9,6 +9,9 @@ static void generic_set_resources(struct device *dev)
{
struct resource *res;
if (!dev)
return;
if (dev->link_list)
assign_resources(dev->link_list);