/* For licensing information, see the file 'LICENCE' in this directory.  */
int jffs2_sum_init(struct jffs2_sb_info *c)
/* For licensing information, see the file 'LICENCE' in this directory.  */
int jffs2_sum_init(struct jffs2_sb_info *c)
{
	uint32_t sum_size = min_t(uint32_t, c->sector_size, MAX_SUMMARY_SIZE);
	c->summary = kzalloc(sizeof(struct jffs2_summary), GFP_KERNEL);
	if (!c->summary) {
		JFFS2_WARNING("Can't allocate memory for summary information!\n");
		return -ENOMEM;
	}
	c->summary->sum_buf = kmalloc(sum_size, GFP_KERNEL);
	if (!c->summary->sum_buf) {
		JFFS2_WARNING("Can't allocate buffer for writing out summary information!\n");
		kfree(c->summary);
		return -ENOMEM;
	}
	dbg_summary("returned successfully\n");
	return 0;
}