Skip to content

Commit 0711bb1

Browse files
chrissnowadbridge
authored andcommitted
Tidy if else code aligment.
1 parent d3b1f69 commit 0711bb1

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

targets/TARGET_NXP/TARGET_LPC176X/device/flash_api.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,9 @@ int32_t flash_program_page(flash_t *obj, uint32_t address,
122122
IAP.cmd = 51;// Copy RAM to Flash
123123
IAP.par[0] = address;// Destination Flash Address
124124

125-
if ((unsigned long)data%4==0)// Word boundary
126-
{
125+
if ((unsigned long)data%4==0){// Word boundary
127126
IAP.par[1] = (unsigned long)data;// Source RAM Address
128-
}
129-
else
130-
{
127+
} else {
131128
alignedData = malloc(size);
132129
memcpy(alignedData,data,size);
133130
IAP.par[1] = (unsigned long)alignedData;// Source RAM Address
@@ -137,8 +134,7 @@ int32_t flash_program_page(flash_t *obj, uint32_t address,
137134
IAP.par[3] = CCLK;// CCLK in kHz
138135
IAP_Call (&IAP.cmd, &IAP.stat);// Call IAP Command
139136

140-
if(alignedData !=0)//We allocated our own memory
141-
{
137+
if(alignedData !=0){//We allocated our own memory
142138
free(alignedData);
143139
}
144140

@@ -149,16 +145,12 @@ int32_t flash_program_page(flash_t *obj, uint32_t address,
149145

150146
uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
151147
{
152-
if(address < flash_get_start_address(obj) || address >= flash_get_start_address(obj) +flash_get_size(obj))
153-
{
148+
if(address < flash_get_start_address(obj) || address >= flash_get_start_address(obj) +flash_get_size(obj)){
154149
return MBED_FLASH_INVALID_SIZE;
155150
}
156-
if(GetSecNum(address)>=0x10)
157-
{
151+
if(GetSecNum(address)>=0x10){
158152
return 0x8000;
159-
}
160-
else
161-
{
153+
} else {
162154
return 0x1000;
163155
}
164156
}

0 commit comments

Comments
 (0)