Changeset d6f0ca64 in rtems for cpukit/dev/i2c


Ignore:
Timestamp:
Nov 26, 2014, 7:24:39 AM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
90b0e28
Parents:
39af57c3
git-author:
Sebastian Huber <sebastian.huber@…> (11/26/14 07:24:39)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/26/14 07:26:15)
Message:

i2c: Avoid undefined right shift operation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/dev/i2c/eeprom.c

    r39af57c3 rd6f0ca64  
    222222  if (address_bytes > EEPROM_MAX_ADDRESS_BYTES) {
    223223    rtems_set_errno_and_return_minus_one(ERANGE);
     224  } else if (address_bytes == EEPROM_MAX_ADDRESS_BYTES) {
     225    extra_address = 0;
     226  } else {
     227    extra_address = size_in_bytes >> (8 * address_bytes);
     228  }
     229
     230  if (extra_address != 0 && (extra_address & (extra_address - 1)) != 0) {
     231    rtems_set_errno_and_return_minus_one(EINVAL);
    224232  }
    225233
    226234  if (page_size_in_bytes > EEPROM_MAX_PAGE_SIZE) {
    227235    page_size_in_bytes = EEPROM_MAX_PAGE_SIZE;
    228   }
    229 
    230   extra_address = size_in_bytes >> (8 * address_bytes);
    231   if (extra_address != 0 && (extra_address & (extra_address - 1)) != 0) {
    232     rtems_set_errno_and_return_minus_one(EINVAL);
    233236  }
    234237
Note: See TracChangeset for help on using the changeset viewer.