Flash it with the latest firmware, format any SD cards, re-set the lock code to the default and disable R&D mode and flags if they were enabled.