diff --git a/dsp/q6afe.c b/dsp/q6afe.c old mode 100644 new mode 100755 index aeda849ec414..8e7c57608e45 --- a/dsp/q6afe.c +++ b/dsp/q6afe.c @@ -8628,10 +8628,8 @@ done: } EXPORT_SYMBOL(afe_set_display_stream); -int afe_validate_port(u16 port_id) +static bool is_port_valid(u16 port_id) { - int ret; - switch (port_id) { case PRIMARY_I2S_RX: case PRIMARY_I2S_TX: @@ -8841,15 +8839,23 @@ int afe_validate_port(u16 port_id) case RT_PROXY_PORT_002_RX: case RT_PROXY_PORT_002_TX: { - ret = 0; - break; + return true; } - default: + return false; + } +} + +int afe_validate_port(u16 port_id) +{ + int ret; + + if (is_port_valid(port_id)) { + ret = 0; + } else { pr_err("%s: default ret 0x%x\n", __func__, port_id); ret = -EINVAL; } - return ret; } @@ -8884,7 +8890,9 @@ int afe_convert_virtual_to_portid(u16 port_id) * if port_id is virtual, convert to physical.. * if port_id is already physical, return physical */ - if (afe_validate_port(port_id) < 0) { + if (is_port_valid(port_id)) { + ret = port_id; + } else { if (port_id == RT_PROXY_DAI_001_RX || port_id == RT_PROXY_DAI_001_TX || port_id == RT_PROXY_DAI_002_RX || @@ -8897,8 +8905,7 @@ int afe_convert_virtual_to_portid(u16 port_id) __func__, port_id); ret = -EINVAL; } - } else - ret = port_id; + } return ret; }