You yust should set USBPPL and PPLDIV to 48MHz, or divide by 12 if you use 48MHz resonator.
I think that code is good.