Re: [PATCH v4 11/21] soc: qcom: Register pstore frontend region with minidump

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 28, 2023 at 06:04:38PM +0530, Mukesh Ojha wrote:
> +static int qcom_ramoops_md_region_register(struct device *dev, struct qcom_minidump_region **zone,
> +					   const char *name, phys_addr_t phys_addr,
> +					   unsigned long size)
> +{
> +	struct qcom_minidump_region *md_region;
> +	int ret;
> +
> +	if (!size)
> +		return 0;
> +
> +	md_region = devm_kzalloc(dev, sizeof(*md_region), GFP_KERNEL);
> +	if (!md_region)
> +		return -ENOMEM;
> +
> +	strscpy(md_region->name, name, sizeof(md_region->name));
> +	md_region->phys_addr = phys_addr;
> +	md_region->virt_addr = phys_to_virt(phys_addr);
> +	md_region->size = size;
> +	*zone = md_region;
> +	ret = qcom_minidump_region_register(md_region);
> +	if (ret)
> +		dev_err(dev, "failed to add %s in minidump: err: %d\n", name, ret);
> +
> +	return ret;
> +}
> +
> +static int qcom_ramoops_minidump_register(struct qcom_ramoops_dd *qcom_rdd)
> +{
> +	struct ramoops_platform_data *pdata = &qcom_rdd->qcom_ramoops_pdata;
> +	char name[MAX_NAME_LENGTH];
> +	size_t zone_sz;
> +	phys_addr_t phys_addr;
> +	int ret = 0;
> +	int i;
> +
> +	phys_addr = pdata->mem_address;
> +	for (i = 0; i < qcom_rdd->max_dump_cnt; i++) {
> +		scnprintf(name, sizeof(name), "KDMSG%d", i);
> +		ret = qcom_ramoops_md_region_register(qcom_rdd->dev,
> +			&qcom_rdd->dmesg_region[i], name, phys_addr,
> +			pdata->record_size);
> +		if (ret)
> +			return ret;
> +
> +		phys_addr += pdata->record_size;
> +	}
> +
> +	ret = qcom_ramoops_md_region_register(qcom_rdd->dev,
> +			&qcom_rdd->console_region, "KCONSOLE", phys_addr,
> +			pdata->console_size);
> +	if (ret)
> +		return ret;
> +
> +	phys_addr += pdata->console_size;
> +
> +	ret = qcom_ramoops_md_region_register(qcom_rdd->dev,
> +			&qcom_rdd->pmsg_region, "KPMSG", phys_addr,
> +			pdata->pmsg_size);
> +	if (ret)
> +		return ret;
> +
> +	phys_addr += pdata->pmsg_size;
> +
> +	zone_sz =  pdata->ftrace_size / qcom_rdd->max_ftrace_cnt;
> +	for (i = 0; i < qcom_rdd->max_ftrace_cnt; i++) {
> +		ret = qcom_ramoops_md_region_register(qcom_rdd->dev,
> +			&qcom_rdd->ftrace_region[i], "KFTRACE", phys_addr,
> +			zone_sz);
> +		if (ret)
> +			return ret;
> +
> +		phys_addr += zone_sz;
> +	}
> +
> +	return ret;
> +}

This may be the least of your worries, but plan to fix the error
handling in this function. The probe expects this function to self clean
when returning error.

Thanks,
Pavan



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux