nb/intel: Use "if (!ptr)" in preference to "if (ptr == NULL)"

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Change-Id: I6d0d945011fa046b974c6f4554cb9fb15e523afb
Reviewed-on: https://review.coreboot.org/c/coreboot/+/67578
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Elyes Haouas 2022-09-13 09:55:49 +02:00 committed by Felix Held
parent 1fac2e20b8
commit 5e6b0f0cac
9 changed files with 9 additions and 9 deletions

View File

@ -152,7 +152,7 @@ static void gma_func0_init(struct device *dev)
intel_gma_init_igd_opregion(); intel_gma_init_igd_opregion();
gtt_res = probe_resource(dev, PCI_BASE_ADDRESS_0); gtt_res = probe_resource(dev, PCI_BASE_ADDRESS_0);
if (gtt_res == NULL) if (!gtt_res)
return; return;
mmio = res2mmio(gtt_res, 0, 0); mmio = res2mmio(gtt_res, 0, 0);

View File

@ -174,7 +174,7 @@ void northbridge_write_smram(u8 smram)
{ {
struct device *dev = pcidev_on_root(0, 0); struct device *dev = pcidev_on_root(0, 0);
if (dev == NULL) if (!dev)
die("could not find pci 00:00.0!\n"); die("could not find pci 00:00.0!\n");
pci_write_config8(dev, D0F0_SMRAM, smram); pci_write_config8(dev, D0F0_SMRAM, smram);

View File

@ -116,7 +116,7 @@ void northbridge_write_smram(u8 smram)
{ {
struct device *dev = pcidev_on_root(0, 0); struct device *dev = pcidev_on_root(0, 0);
if (dev == NULL) if (!dev)
die("could not find pci 00:00.0!\n"); die("could not find pci 00:00.0!\n");
pci_write_config8(dev, SMRAM, smram); pci_write_config8(dev, SMRAM, smram);

View File

@ -172,7 +172,7 @@ static void gma_read_resources(struct device *dev)
/* Set the graphics memory to write combining. */ /* Set the graphics memory to write combining. */
res = probe_resource(dev, PCI_BASE_ADDRESS_2); res = probe_resource(dev, PCI_BASE_ADDRESS_2);
if (res == NULL) { if (!res) {
printk(BIOS_DEBUG, "gma: memory resource not found.\n"); printk(BIOS_DEBUG, "gma: memory resource not found.\n");
return; return;
} }

View File

@ -3207,7 +3207,7 @@ void raminit(const int s3resume, const u8 *spd_addrmap)
} }
if (s3resume) { if (s3resume) {
if (info.cached_training == NULL) { if (!info.cached_training) {
u32 reg32; u32 reg32;
printk(BIOS_ERR, printk(BIOS_ERR,
"Couldn't find training data. Rebooting\n"); "Couldn't find training data. Rebooting\n");

View File

@ -118,7 +118,7 @@ void northbridge_write_smram(u8 smram)
{ {
struct device *dev = pcidev_on_root(0, 0); struct device *dev = pcidev_on_root(0, 0);
if (dev == NULL) if (!dev)
die("could not find pci 00:00.0!\n"); die("could not find pci 00:00.0!\n");
pci_write_config8(dev, SMRAM, smram); pci_write_config8(dev, SMRAM, smram);

View File

@ -107,7 +107,7 @@ static void setup_sdram_meminfo(ramctr_timing *ctrl)
/* The 'spd_add_smbios17' function allocates this CBMEM area */ /* The 'spd_add_smbios17' function allocates this CBMEM area */
struct memory_info *m = cbmem_find(CBMEM_ID_MEMINFO); struct memory_info *m = cbmem_find(CBMEM_ID_MEMINFO);
if (m == NULL) if (!m)
return; return;
const uint32_t capid0_a = pci_read_config32(HOST_BRIDGE, CAPID0_A); const uint32_t capid0_a = pci_read_config32(HOST_BRIDGE, CAPID0_A);

View File

@ -111,7 +111,7 @@ static void prepare_mrc_cache(struct pei_data *pei_data)
pei_data->mrc_input = mrc_cache_current_mmap_leak(MRC_TRAINING_DATA, pei_data->mrc_input = mrc_cache_current_mmap_leak(MRC_TRAINING_DATA,
MRC_CACHE_VERSION, MRC_CACHE_VERSION,
&mrc_size); &mrc_size);
if (pei_data->mrc_input == NULL) { if (!pei_data->mrc_input) {
/* Error message printed in find_current_mrc_cache */ /* Error message printed in find_current_mrc_cache */
return; return;
} }

View File

@ -138,7 +138,7 @@ void northbridge_write_smram(u8 smram)
{ {
struct device *dev = pcidev_on_root(0, 0); struct device *dev = pcidev_on_root(0, 0);
if (dev == NULL) if (!dev)
die("could not find pci 00:00.0!\n"); die("could not find pci 00:00.0!\n");
pci_write_config8(dev, D0F0_SMRAM, smram); pci_write_config8(dev, D0F0_SMRAM, smram);