[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <99c98f22-69f7-4a6a-acc9-6a6a6bdb2031@quicinc.com>
Date: Fri, 30 Jun 2023 10:25:06 +0530
From: Pavan Kondeti <quic_pkondeti@...cinc.com>
To: Mukesh Ojha <quic_mojha@...cinc.com>
CC: <corbet@....net>, <agross@...nel.org>, <andersson@...nel.org>,
<konrad.dybcio@...aro.org>, <robh+dt@...nel.org>,
<krzysztof.kozlowski+dt@...aro.org>, <conor+dt@...nel.org>,
<keescook@...omium.org>, <tony.luck@...el.com>,
<gpiccoli@...lia.com>, <mathieu.poirier@...aro.org>,
<catalin.marinas@....com>, <will@...nel.org>,
<linus.walleij@...aro.org>, <andy.shevchenko@...il.com>,
<linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-msm@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-hardening@...r.kernel.org>,
<linux-remoteproc@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-gpio@...r.kernel.org>
Subject: Re: [PATCH v4 11/21] soc: qcom: Register pstore frontend region with
minidump
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
Powered by blists - more mailing lists