The important thing is to ensure your employment doesn't end until the last day of your maternity leave, as you keep accruing holiday and any other benefits throughout maternity leave.
But if you are absolutely certain you won't go back, there's no reason you can't give them more notice than you are required to give, to be helpful. As long as you are clear what your end date will be there's no problem.
Please forgive me if this has been covered before, I'm on my phone and can't search for any previous threads.
I'm currently on mat leave, and have one payment of SMP left before dropping to no-pay leave. I'm definitely not going back to work, and I was wondering what the pros and cons are of handing in my notice now, or waiting until the end of the no pay portion of my leave?