The P0401 is as you wrote is for EGR insufficient flow. The most common failure on these is the EGR position sensor which is mounted on top of the EGR valve. The sensor indicates the wrong reading to the PCM (Powertrain Control Module). Sometimes though the EGR valve itself fails. If this happens the only way to get the valve is with the sensor attached. You can check the valve to see if it is working by using a vacuum pump and applying vacuum to the valve with the engine running to see if the engine dies. If it dies the valve is working correctly. If it does not then the valve is not working.
What about the corresponding p0172 reading?
The way an EGR valve works is it directs exhaust gas into the intake to be reburnt the exhaust leans out the system if it is not allowing the EGR gasses the oxygen sensors will think that it is running rich. Fix the EGR fault and it may take care of the rich condition.