Your Volvo will not pass the smog check with P0102 and P0456 trouble codes present. You must repair the faults triggering these trouble code before you have the smog test administered.
P0102 refers to your Volvo's Mass Air Flow (MAF) Sensor. Your Volvo V40's engine computer has detected a problem with the MAF and has triggered trouble code P0102. The MAF sensor may be disconnected, its wiring and/or connection may be bad, the MAF may simply have collected dirt over time, or the it may be defective/damaged. The MAF sensor measures the amount of air entering the intake manifold, sends this information to the engine control computer, which in turn controls fuel injection.
We recommend replacing the MAF sensor after ensuring the wiring and connection harness is in good shape, and obviously not disconnected. The cost for an OEM MAF sensor for your Volvo V40 should be around $150.00 and can be found from a local auto parts store. The repair time involved should be around one hour or less.
P0456 is a bit trickier in that it refers to a "small" leak found in the EVAP system. Your Volvo's EVAP system is designed to return fuel tank vapor to the engine. The EVAP test ensures fuel vapors do not leak into the atmosphere. Finding a small EVAP leak may be tedious. The first recommendation is to ensure your gas cap is in good condition and properly sealing the gas tank. Often a smog stations recommendation is to purchase and install a new gas cap and reset the engine computer to see P0456 returns. If after replacing the gas cap and clearing the trouble code it does not return... problem solved, faulty gas cap. If the trouble code does return, then a diagnosis will be need to locate the EVAP leak. It may be located anywhere vapor hoses exist between the gas tank and the engine, including the EVAP canister itself.