That doesn't guarantee the problem will stay solved if you add code to the program, change optimisation level or upgrade the compiler. If you have
asm("MOVLW 0x55");
asm("MOVWF EECON2");
asm("MOVLW 0xAA");
asm("MOVWF EECON2");
EECON1bits.WR = 1;
the compiler may choose to insert instructions between the last asm() statement and setting the WR bit in C. To make sure it stays fixed, you *MUST* set the WR bit using an assembler BSF instruction.
@JPortici: There's a known issue with some versions of the compiler - at high optimisation levels, if you have more than one EEPROM unlock sequence in the program, the optimiser may recognise the code duplication and replace all copies with a subroutine call to a single copy. Unfortunately, the optimiser sometimes isn't aggressive enough and fails to put the following BSF EECON1,1 in the subroutine, which causes the subroutine RETURN to break the critical unlock sequence.