Try specifying the priority for your function. You will also want to remove the default canonical link before adding your modified one. This worked on my site:
function canonical_for_comments()
{
global $cpage, $post;
if (!empty($cpage) && $cpage > 0) {
remove_action('wp_head', 'rel_canonical');
echo '<link rel="canonical" href="' . esc_url(get_permalink($post->ID)) . '" />';
echo "\n";
}
}
add_action( 'wp_head', 'canonical_for_comments', 9 );