If the hole is not very large, there is an easy trick to fixing it.
1) Cut out the hole so that it is square.
2) Cut a new piece of drywall, but make it about 4″ bigger on both sides.
3) Score the patch on the back side of the drywall to the size of the hole, but do it so that there is a 2″ piece on all 4 sides.
4) Snap the drywall patch to break off the 4 pieces, but DO NOT cut the paper on the front of the patch. Instead, just peel off the drywall and leave the front paper attached to the patch.
5) Use the front paper on the patch as the joint tape and just mud the patch into place. The joint compound will hold the patch in place.
Easier than trying to cut a big hole and screwing boards in behind a small hole. This is good for holes that are only a few inches in both direction. I have used this method many times, and it works great.