It is a little confusing, they ruled that the search was not legitimate, but this didn’t end up helping the defendant? I’m definitely missing an important nuance here but I’m not sure what it is…
The judge doesn't care if the law was violated in collecting evidence.
https://en.wikipedia.org/wiki/Good-faith_exception