for p0171, the cause:
The MAF (Mass Air Flow) Sensor is dirty or faulty. Note: The use of "oiled" air filters may cause the MAF to become dirty if the filter is over-oiled. There is also an issue with some vehicles where the MAF sensors leak the silicone potting material used to protect the circuitry.
There could be a vacuum leak downstream of the MAF sensor.
In the vast majority of cases, simply cleaning the MAF sensor does the trick. Consult your service manual for it's location if you need help. I find it's best to take it off and spray it with electronics cleaner or brake cleaner. Make sure you are careful not to damage the MAF sensor, and make sure it's dry before reinstalling
Inspect all vacuum and PCV hoses, replace if necessary
Check for a dirty fuel filter and proper fuel pressure