/* Returns the number of characters generated on success; otherwise, < 0 on error.  */
static int ppc4xx_edac_generate_ecc_message(const struct mem_ctl_info *mci, const struct ppc4xx_ecc_status *status, char *buffer, size_t size)
/* Returns the number of characters generated on success; otherwise, < 0 on error.  */
static int ppc4xx_edac_generate_ecc_message(const struct mem_ctl_info *mci, const struct ppc4xx_ecc_status *status, char *buffer, size_t size)
{
	int n, total = 0;
	n = ppc4xx_edac_generate_bank_message(mci, status, buffer, size);
	if (n < 0 || n >= size)
		goto fail;
	buffer += n;
	size -= n;
	total += n;
	n = ppc4xx_edac_generate_checkbit_message(mci, status, buffer, size);
	if (n < 0 || n >= size)
		goto fail;
	buffer += n;
	size -= n;
	total += n;
	n = ppc4xx_edac_generate_lane_message(mci, status, buffer, size);
	if (n < 0 || n >= size)
		goto fail;
	buffer += n;
	size -= n;
	total += n;
 fail:
	return total;
}