As a former realtor, a huge issue with buyers and sellers is determining the necessity of repairs based on a home inspection. Unfortunately, there are too many buyers who demand that the seller fix or repair minor things that have nothing to do with the functionality or habitability of the home (painting, appliances, carpeting, etc.) Yet if the seller refuses, the buyer threatens to cancel the transaction and walk out. These minor fixes can easily be resolved by the buyer. Example - buyers can purchase brand new appliances online and have it installed for a much lower price than canceling a real estate transaction. Stores are always having sales.
Then there is the issue of major repairs (mold, infestation, electrical, plumbing, roof). For issues like these, the seller can always lower the contract price instead of the buyer canceling the transaction completely and walking away. If the seller is motivated to sell their home, they are more likely to work with the buyer instead of having to start all over and find a new buyer. In the majority of cases like this, the seller will be forced to lower their asking price anyway. So it benefits you to re negotiate the contract and you get the lower price.
If you do cancel the transaction, getting your earnest money deposit returned depends on the wording of your contract.