You already own a .40 and a 9mm? Easy, which one are you more comfortable shooting.
Sure, the .40 probably has more "firepower" or whatever, but it's still a handgun round. The effectiveness of the 9mm, 40, 45 are all marginal differences and each caliber carries its own disadvantages as well. I say this as someone who uses a .45 ACP for their home defense gun, there is nothing wrong with 9mm for self defense.
If you're comfortable shooting .40 and generally like it better or have more confidence in the .40 than the 9mm, then get the G22. However, you are not making a huge compromise in your safety going with the G17.
"For every problem there is always a solution that is simple, obvious, and wrong." - Mark Twain