OpenNetworkLinux icon indicating copy to clipboard operation
OpenNetworkLinux copied to clipboard

[ONLPv2][sfp.c] Need to put onlp_sfp_control_flags_get function behind onlp_sfp_is_present

Open ryanliou72 opened this issue 7 years ago • 1 comments

Hi

In onlpv2-sfp.c

[OpenNetworkLinux\packages\base\any\onlp\src\onlp\module\src\sfp.c]

[int onlp_sfp_info_get(onlp_oid_t oid, onlp_sfp_info_t* info)]

if(ONLP_FAILURE(rv = onlp_sfp_control_flags_get(oid, &info->controls))) {
        AIM_LOG_ERROR("%{onlp_oid}: sfp_info_get: sfp_control_flags_get returned %{onlp_status}",
                      oid, rv);
        return rv;
    }

if(ONLP_FAILURE(rv = onlp_sfp_is_present(oid))) {
    AIM_LOG_ERROR("%{onlp_oid}: sfp_info_get: is_present returned %{onlp_status}",
                  oid, rv);
    return rv;
}

I think we need to put function

[onlp_sfp_control_flags_get]

behind

[onlp_sfp_is_present]

to make sure sfp is present when we want to get the control value.

Am I right?

ryanliou72 avatar Oct 26 '18 05:10 ryanliou72

Hi

if we get control value without checking sfp present status, it will fail because no sfp eeprom and return error. What do you think about this issue?

Thank you for your reply. Ryan

ryanliou72 avatar Jun 13 '19 01:06 ryanliou72