soc/mediatek: Use "if (!ptr)" in preference to "if (ptr == NULL)"

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Change-Id: I9cf4097518034fa4c3ae1899840ae3a276936f80
Reviewed-on: https://review.coreboot.org/c/coreboot/+/67581
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Elyes Haouas 2022-09-13 09:57:30 +02:00 committed by Felix Held
parent 5e6b0f0cac
commit 0f1fb8a868
5 changed files with 7 additions and 7 deletions

View File

@ -30,7 +30,7 @@ static u32 buf_read(u32 addr)
{
u32 rdata;
if (pmif_arb == NULL)
if (!pmif_arb)
pmif_arb = get_pmif_controller(PMIF_SPI, 0);
pmif_arb->read(pmif_arb, 0, addr, &rdata);
@ -39,7 +39,7 @@ static u32 buf_read(u32 addr)
static void buf_write(u32 addr, u32 wdata)
{
if (pmif_arb == NULL)
if (!pmif_arb)
pmif_arb = get_pmif_controller(PMIF_SPI, 0);
pmif_arb->write(pmif_arb, 0, addr, wdata);
}

View File

@ -443,7 +443,7 @@ static void set_early_mmc_wake_status(int32_t status)
ms_cbmem = cbmem_add(CBMEM_ID_MMC_STATUS, sizeof(status));
if (ms_cbmem == NULL) {
if (!ms_cbmem) {
printk(BIOS_ERR,
"%s: Failed to add early mmc wake status to cbmem!\n",
__func__);

View File

@ -135,7 +135,7 @@ s32 pwrap_wacs2(u32 write, u16 addr, u16 wdata, u16 *rdata, u32 init_check)
write32(&mtk_pwrap->wacs2_cmd, wacs_cmd);
if (write == 0) {
if (rdata == NULL) {
if (!rdata) {
pwrap_err("rdata is a NULL pointer\n");
return E_PWR_INVALID_ARG;
}

View File

@ -15,7 +15,7 @@ void rtc_read(u16 addr, u16 *rdata)
{
u32 data;
if (pmif_arb == NULL)
if (!pmif_arb)
pmif_arb = get_pmif_controller(PMIF_SPI, 0);
pmif_arb->read(pmif_arb, 0, (u32)addr, &data);
@ -24,7 +24,7 @@ void rtc_read(u16 addr, u16 *rdata)
void rtc_write(u16 addr, u16 wdata)
{
if (pmif_arb == NULL)
if (!pmif_arb)
pmif_arb = get_pmif_controller(PMIF_SPI, 0);
pmif_arb->write(pmif_arb, 0, (unsigned int)addr, (unsigned int)wdata);
}

View File

@ -118,7 +118,7 @@ static void pmic_read(u32 addr, u32 *rdata)
{
static struct pmif *pmif_arb;
if (pmif_arb == NULL)
if (!pmif_arb)
pmif_arb = get_pmif_controller(PMIF_SPI, 0);
pmif_arb->read(pmif_arb, 0, addr, rdata);