With the forces of the turn of the backswing it can be easy to lock the right knee at the top fo the swing. But when you lock the right knee it hinders the flow of a smooth transition and it also tends to change you posture angle which impacts club path.
Clearly there is flexion and extension that is happening in the knees through the swing as you can see if these photos of Dustin Johnson. But he doesn't lock the right knee at the top of the backswing. It is still flexed enough be be fluid in the support of the rotation.
Notice how the left knee bends in the backswing which support the left shoulder going low. Then going into the impact the right knee flexes significantly as part of the right side bend and the right shoulder going low. You can also see how the knee action supports the left side opening up.
So like any fluid athletic motion, there are lots of moving parts and fluid motion in the knees is part of a stable rotation.
Rob Stanger shows some good feelings to have when you look at knee action.