Project

General

Profile

Actions

Bug #2223

closed

common/power_control.c: strange conditions

Added by fixeria almost 7 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
-
Target version:
-
Start date:
05/04/2017
Due date:
% Done:

100%

Spec Reference:

Description

Look at the lchan_ms_pwr_ctrl():

int lchan_ms_pwr_ctrl(struct gsm_lchan *lchan,
    const uint8_t ms_power, const int rxLevel)
{
    int rx;
    int cur_dBm, new_dBm, new_pwr;
    struct gsm_bts *bts = lchan->ts->trx->bts;
    struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
    const enum gsm_band band = bts->band;

    // ...

    /*
     * What is the difference between what we want and received?
     * Ignore a margin that is within the range of measurement
     * and MS output issues.
     */
    rx = btsb->ul_power_target - rxLevel;
    if (rx >= 0 && rx < 1)
        return 0;
    if (rx < 0 && rx > -1) // Unreachable 
        return 0;

    // ...
}

if (rx < 0 && rx > -1)

As rx has type int, it cannot be in range (-1; 0)...

if (rx >= 0 && rx < 1)

Again, the only possible value here is 0.

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)