There is nothing wrong with that, as Allaah pointed out something like that in the words of Nooh to his people (interpretation of the meaning):
“I [Nooh] said (to them): ‘Ask forgiveness from your Lord, verily, He is Oft‑Forgiving;
11. ‘He will send rain to you in abundance,
12. ‘And give you increase in wealth and children, and bestow on you gardens and bestow on you rivers”
And the Prophet (peace and blessings of Allaah be upon him) said: “Wealth never decreases because of charity.”
And he (peace and blessings of Allaah be upon him) said: “Whoever would like to have his lifespan extended and his provision increased, let him uphold his ties of kinship.”
Allaah has only stipulated these worldly benefits in order to encourage people, because if they are encouraged they will do these good deeds, and the one who is seeking the Hereafter will attain benefits in this world and in the Hereafter, as Allaah says (interpretation of the meaning):
“Whosoever desires (by his deeds) the reward of the Hereafter, We give him increase in his reward”[al-Shoora 42:20], i.e., We will give him reward in this world and in the Hereafter. As for only doing acts of worship in the hope of gaining worldly benefits only, this is undoubtedly a shortcoming in intention which is caused by love of this world in the heart of the one who does that. End quote.
Shaykh Muhammad ibn ‘Uthaymeen (may Allaah have mercy on him).