Are you reset the stored codes there? The EGR (Exhaust Gas Recirculation) valve controls an engine's emission of smog-causing nitrous oxides, or NOx. Its job is to route a portion of the exhaust gases back into the intake manifold. That lowers combustion temperature to below 2,500 degrees Fahrenheit - the temperature at which NOx gases form.
EGR flow is controlled by the engine's computer, which opens or closes the valve as needed. The EGR system is, for the most part, in the "out of sight, out of mind" category, and typical doesn't require regular maintenance. But if it gets clogged with carbon deposits, you'll see your "check engine" light come on, and a code (perhaps P0401 or P0402 or P0403) will show that there is insufficient flow. That typically results from a vehicle being driven persistently on short trips that don't allow the engine to fully warm up. Flow problems also can be caused by carbon buildup due to failure to change the oil frequently enough.
A clogged EGR valve not only results in higher emissions, it can affect fuel economy and cause rough idling - even serious engine damage. Valves can usually be cleaned, but replacement is often recommended.
About thie generic fault code, I suggtes check this description and tips for solution information: DTC-P0401-Tests
(keep in midn that this code applied for alot brands, Hyundai included).
Keep us updated.