Project

General

Profile

Bug #2223

common/power_control.c: strange conditions

Added by fixeria over 2 years ago. Updated almost 2 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.

History

#1 Updated by laforge over 2 years ago

#2 Updated by laforge over 2 years ago

  • Assignee set to msuraev

#3 Updated by laforge about 2 years ago

  • Priority changed from Normal to High

#4 Updated by msuraev about 2 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

Before making any changes, let's make sure we got proper test coverage. Gerrit 4222 and 4223 ensures that.

#5 Updated by msuraev about 2 years ago

  • Status changed from In Progress to Stalled

#6 Updated by msuraev about 2 years ago

  • % Done changed from 10 to 20

Gerrit 4222 and 4223 are merged.

#7 Updated by msuraev about 2 years ago

  • Status changed from Stalled to In Progress
  • % Done changed from 20 to 50

Fix is under review in gerrit 5039.

#8 Updated by msuraev about 2 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 50 to 100

Gerrit 5039 has been merged.

#9 Updated by laforge almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)