I previously had DD-WRT running on my router however I wanted to roll it back. There is a little known trick built into most modern D-Link routers that allow you to recover the firmware. This method would also likely recover you from a bad flash.
To change the firmware back to factory you can't just load it in the DD-WRT interface. Instead you need to link your computer to the port 1 on your router using the Ethernet cable. It is also wise to turn off your wifi. From there you need to set the following settings:
192.168.0.2 255.255.255.0 192.168.0.1
Here is a screen shot from a mac as an example:
Turn the router upside down, turn the router off and then on holding down the reset button using a pin. The power light will then flash slowly / pulsate.
Next open your web browser and go to 192.168.0.1. The flash recovery page will appear:
Click browse to select the firmware image from D-Link and press upload.
The router will then restart.
The router will be fully set to factory defaults. You can now change your computer wifi back on if you wish and remove the network cable. Follow the setup guide using the d-link instructions.