From this year's Redding guide, page 110:
Inadvertent Whistle
In an inadvertent whistle is sounded after Team B gains possession, the down is over and is not replayed unless a foul that was committed before the change of possession results in the down being replayed with Team A snapping the ball (4-1-2b4).
Page 209-210:
During a Snap, Kick, or Forward Legal Pass:
Whenever an inadvertent whistle sounds during a snap, kick or a legal forward pass, there is no option: the ball is returned to the previous spot and the down is replayed (4-1-2b3).
How Do We Treat A Foul?
Penalties for fouls and violations during a play where there is an inadvertent whistle are administered as in any other play situation (4-1-2c). That means if there is a live-ball foul on the play and the penalty is accepted, the penalty is administered, and the inadvertent whistle is ignored.
some examples are listed, this one seems relevant:
Example 12-13
4/17 at the A-45. During Team A's punt that crosses the neutral zone, B63 blocks below the waist five yards beyond the neutral zone. An official sounds his whistle while the kick is still in the air.
RULING:
The ball must be returned to the previous spot, because the whistle occurred during the kick. The previous spot then becomes the basic spot, so the the penalty for Team B's foul is enforced from this point. It will be 1/10 for Team A at the B-40.