Islamic Ruling on Giving Charity on Behalf of Deceased Parents
Charity on behalf of a deceased Muslim is allowed and benefits them, but charity on behalf of a deceased non-Muslim is not allowed.

Hazrat Saad bin Ubadah (R.A) asked the Prophet (PBUH) if he could give charity on behalf of his mother who had passed away. The Prophet (PBUH) said yes. When he asked which charity is best, the Prophet (PBUH) said that giving water is best. This is in Nasai 3694.
From this Hadith, Islamic scholars say that giving charity on behalf of a deceased Muslim is allowed, and the reward reaches the deceased. But giving charity on behalf of a deceased non-Muslim is not allowed, because it does not benefit them. Even their good deeds do not bring them reward in the Hereafter.
Allah says that those who die as disbelievers will not have any ransom accepted from them, even if it is as much as the earth filled with gold. They will have a painful punishment and no helpers. This is in Surah Aal Imran 91.
Allah also says that it is not allowed for the Prophet or the believers to ask forgiveness for polytheists. This is in Surah At-Tawbah 113.
Based on these verses, jurists say that charity or seeking forgiveness on behalf of a deceased non-Muslim is not correct.