As simple as it sounds.
This you find on pretty much all HTC phones as well, I’ve got it on all HTC phones I’ve looked at. But, will focus on One M8 now.
So, tell me! How do you do it?
It’s just to go to Settings > Accessibility, where you tick Power button ends call. And, that’s it! Of course this is where you disable it if you get annoyed about it. The default value of it should be OFF.