I have reset my phone to factory settings and it didn't fix the problem. The weird thing is i reset it by holding the power button on the side. Otherwise both buttons don't function.
Read more:
Home button and off button on Samsung galaxy S7 not working?