Discuss the matter with an Authorized Mazda Dealer. This is the quickest and best way to address the issue.
Customer Assistance (U.S.A.)
STEP 2: Contact Mazda North American OperationsMazda 6 Owners Manual: Cargo compartment light switch inspection
1. Remove the liftgate lower trim. (See LIFTGATE LOWER TRIM
REMOVAL/INSTALLATION)
2. Disconnect the cargo compartment light switch connector.
3. Inspect for continuity between the cargo compartment light switch
terminals using an ohmmeter.
If not as specified, replace the liftgate lock.
...
Mazda 6 Owners Manual: Vehicle speedometer sensor (vss) removal/installation
Caution
Water or foreign objects entering the connector can cause a poor
connection or corrosion. Be sure not to drop water or foreign objects on the
connector when disconnecting it.
If foreign materials are stuck to the VSS, disturbance by magnetic
flux can cause sensor output to be ...