Actually, with a Subaru, when it sets a knock sensor code, you can replace it without disconnecting the battery or resetting the ECM to erase the code. The first time it is started, the ECM sees that the problem is corrected and the MIL (CEL) goes out.