Upgrade the firmware on your defective body first and try it out before disposing of it. There are no warranty limitations when upgrading the firmware. Whatever you do, please do point out the defect if you're trading in or selling it.
The 40D is in any case a much better body (possibly better than the 50D).