bnxt_en: Remove unnecessary NULL checks for fw_health
authorVasundhara Volam <vasundhara-v.volam@broadcom.com>
Tue, 10 Dec 2019 07:49:11 +0000 (02:49 -0500)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 Dec 2019 01:37:14 +0000 (17:37 -0800)
After fixing the allocation of bp->fw_health in the previous patch,
the driver will not go through the fw reset and recovery code paths
if bp->fw_health allocation fails.  So we can now remove the
unnecessary NULL checks.

Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c

index d6a5fce..2a100ff 100644 (file)
@@ -9989,8 +9989,7 @@ static void bnxt_fw_health_check(struct bnxt *bp)
        struct bnxt_fw_health *fw_health = bp->fw_health;
        u32 val;
 
-       if (!fw_health || !fw_health->enabled ||
-           test_bit(BNXT_STATE_IN_FW_RESET, &bp->state))
+       if (!fw_health->enabled || test_bit(BNXT_STATE_IN_FW_RESET, &bp->state))
                return;
 
        if (fw_health->tmr_counter) {
@@ -10768,8 +10767,7 @@ static void bnxt_fw_reset_task(struct work_struct *work)
                bnxt_queue_fw_reset_work(bp, bp->fw_reset_min_dsecs * HZ / 10);
                return;
        case BNXT_FW_RESET_STATE_ENABLE_DEV:
-               if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state) &&
-                   bp->fw_health) {
+               if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state)) {
                        u32 val;
 
                        val = bnxt_fw_health_readl(bp,
index acb2dd6..1e7c7c3 100644 (file)
@@ -39,11 +39,10 @@ static int bnxt_fw_reporter_diagnose(struct devlink_health_reporter *reporter,
                                     struct netlink_ext_ack *extack)
 {
        struct bnxt *bp = devlink_health_reporter_priv(reporter);
-       struct bnxt_fw_health *health = bp->fw_health;
        u32 val, health_status;
        int rc;
 
-       if (!health || test_bit(BNXT_STATE_IN_FW_RESET, &bp->state))
+       if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state))
                return 0;
 
        val = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG);
@@ -185,9 +184,6 @@ void bnxt_devlink_health_report(struct bnxt *bp, unsigned long event)
        struct bnxt_fw_health *fw_health = bp->fw_health;
        struct bnxt_fw_reporter_ctx fw_reporter_ctx;
 
-       if (!fw_health)
-               return;
-
        fw_reporter_ctx.sp_event = event;
        switch (event) {
        case BNXT_FW_RESET_NOTIFY_SP_EVENT: