My solution is to write all of my own peripheral libraries from scratch. No vendor code at all. I've done this for STM32F4, LPC176x, LPC43xx, PIC32MX, and several others.
Sure, it's a lot of work, but I'm intimately familiar with the code, it does exactly what I need it to do and no more, and if something doesn't work, I know exactly where to look.