I can see both sides of the issue. The kernel maintainer is within their rights to implement their fix and accept it; they probably work with this codebase a lot and have to deal with issues that crop up. If the added code doesn’t match up in some way, they should be free to fix that.
But this issue could have been handled better. The kernel maintainers should have better attribution mechanisms. At least share authorship in the commit so the patch sender gets credit and is incentivized to contribute more. Its so easy to do that and it can create so much goodwill for little cost.
A solution mentioned a few times here is to take the patch as suggested by the maintainer, but to give a 'co-author' credit to the person who did all the debugging.
This gives the best code quality (or at least style match) and still credits the hard work done by the author.
But this issue could have been handled better. The kernel maintainers should have better attribution mechanisms. At least share authorship in the commit so the patch sender gets credit and is incentivized to contribute more. Its so easy to do that and it can create so much goodwill for little cost.