You can get your washing machine to stop smelling and clean it at the same time by putting some baking soda into the detergent dispenser and adding some vinegar to the washing machine drum.
If your washing machine doesn't have a detergent dispenser then just place the baking soda in the washing machine drum with the vinegar.
Then just turn the washing machine on and let it go through a cycle without clothes and the baking soda and vinegar will get your washing machine clean and make it smell better.
You might also add a little lemon juice along with the baking soda and vinegar to help the washing machine smell even better.