I consider it unlikely that Mr Holmes could have been charged. As has already been stated, he was present in the room by invitation, and he would be able to claim that his actions were in self-defence and defence of others (Dr. Watson).
He would be able to claim that given Helen Stoner's testimony and his examination of the room showing that only a narrow vent existed between the rooms, he expected that the room would be invaded by a venomous creature such as a snake.
Since he did not expect that the offender (whoever he or she may be) would attempt to use this animal to commit another murder as he suspected had already taken place in that bedroom if he did not leave the room unilluminated, he was only able to see movement in the dim light through the vent.
Given that he saw movement and had reason to believe that this lethally venomous animal was coming through the vent, he defended himself with his walking cane, an item of fashion that in the 19th century would have been made of sturdy timber and potentially also metal, and Holmes was known to be an expert in singlestick fighting with just such an implement.
Given Holmes' expertise and the likely weight of his cane, one solid blow to a venomous snake with such a weapon would be likely to cripple or kill it, or at the very least knock it from the imitation bell-rope down which it was climbing to a place where he could strike at it again with intent to kill it.
However, in the darkness, Holmes failed to strike the snake well enough to achieve his intent, and the animal was sufficiently fearful to retreat the way it had come, where it fatally bit its handler.
Therefore Dr Roylott's death from snakebite occured as a result of Mr Holmes' attempts at self-defence against a deadly threat that he had caused. Mr Holmes could show that his response was proportional to the threat, and was not intended to harm any person. It was a regrettable consequence that once the snake had retreated beyond reach of Mr Holmes' cane, Mr Holmes was unable to reach Dr Roylott or his snake before he was fatally bitten by the agitated animal that Mr Holmes was attempting to kill.
A jury hearing that Dr. Roylott (who had a criminal conviction with jail time in Commonwealth territories for an unlawful killing) had likley used his deadly venomous snake to murder one of his step-daughters and attempted to murder the other, and Mr Holmes' and his eyewitness Dr Watson's testimony that he was acting in self-defence when he attempted to kill the snake, would be very likely to find that Mr. Holmes had acted in self-defence and was therefore not guilty.