The H4n will certainly not give the best possible sound, neither for piano nor chamber music. But it will give in both cases results that you can call good.
The main ways in which it's not optimal would be
Noise level. Mobile recorders don't have the best preamps, if just because great preamps require more power than you want to afford from batteries, and the microphone diaphragms aren't that large either to give you a strong signal from low sound pressures. As a result, you need a lot of post-gain, which also boosts the level of inevitable white noise. For chamber music, this is definitely a consideration. But I think the H4n is pretty ok in terms of signal-to-noise ratio.
Stereo image. The H4n is fixed to X/Y stereo. Now, that is a pretty safe setting, with reliable aligned phase relation. Good for precise transients, e.g. when you're recording a piano and it's supposed to sound punchy in a pop mix. However, X/Y has a tendency to sound a bit sterile, even narrow, precisely because there are no phase differences at all and it doesn't pick up a whole lot of room content. For classical recordings I would not often use this setting, but, depending on the room and setting, opt for something ORTF-like, for M/S stereo, a Blumlein pair, or sometimes A/B stereo. You can't get such settings with a mobile recorder with built-in mics.
Good thing is, the H4n has two XLR mic inputs with phantom supply, so you can at any point upgrade your setup with any professional mics. This would largely overcome these problems.
So yeah, something like the H4n will probably work well for you.