linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Niedermaier <cniedermaier@dh-electronics.com>
To: Leonard Crestez <leonard.crestez@nxp.com>,
	Shawn Guo <shawnguo@kernel.org>,
	Anson Huang <Anson.Huang@nxp.com>
Cc: Dong Aisheng <aisheng.dong@nxp.com>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	"linux-imx@nxp.com" <linux-imx@nxp.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/2] ARM: imx: Fix boot crash if ocotp is not found
Date: Wed, 11 Dec 2019 10:25:17 +0000	[thread overview]
Message-ID: <516ff238856842b887d1d673d7e5dac6@dh-electronics.com> (raw)
In-Reply-To: <68b9e3bc9c60c89017648bf3abe150fd0abbde86.1576014367.git.leonard.crestez@nxp.com>

From: Leonard Crestez <leonard.crestez@nxp.com>
Sent: Tuesday, December 10, 2019 10:49 PM
> The imx_soc_device_init functions tries to fetch the ocotp regmap in
> order to soc serial number. If regmap fetch fails then a message is
> printed but regmap_read is called anyway and the system crashes.
>
> Failing to lookup ocotp regmap shouldn't be a fatal boot error so check
> that the pointer is valid.
>
> Only side-effect of ocotp lookup failure now is that serial number will
> be reported as all-zeros which is acceptable.
>
> Cc: stable@vger.kernel.org
> Fixes: 8267ff89b713 ("ARM: imx: Add serial number support for i.MX6/7 SoCs")
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> ---
>  arch/arm/mach-imx/cpu.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
> index d70b6fc72b35..484bf6cdb363 100644
> --- a/arch/arm/mach-imx/cpu.c
> +++ b/arch/arm/mach-imx/cpu.c
> @@ -87,11 +87,11 @@ struct device * __init imx_soc_device_init(void)
>  {
>  	struct soc_device_attribute *soc_dev_attr;
>  	const char *ocotp_compat = NULL;
>  	struct soc_device *soc_dev;
>  	struct device_node *root;
> -	struct regmap *ocotp;
> +	struct regmap *ocotp = NULL;
>  	const char *soc_id;
>  	u64 soc_uid = 0;
>  	u32 val;
>  	int ret;
>  
> @@ -179,11 +179,13 @@ struct device * __init imx_soc_device_init(void)
>  
>  	if (ocotp_compat) {
>  		ocotp = syscon_regmap_lookup_by_compatible(ocotp_compat);
>  		if (IS_ERR(ocotp))
>  			pr_err("%s: failed to find %s regmap!\n", __func__, ocotp_compat);
> +	}
>  
> +	if (!IS_ERR_OR_NULL(ocotp)) {
>  		if (__mxc_cpu_type == MXC_CPU_IMX7ULP) {
>  			regmap_read(ocotp, OCOTP_ULP_UID_4, &val);
>  			soc_uid = val & 0xffff;
>  			regmap_read(ocotp, OCOTP_ULP_UID_3, &val);
>  			soc_uid <<= 16;
> 

Tested-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>

Best regards,
Christoph

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-12-11 10:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10 21:49 [PATCH 0/2] Fix imx6ull/6ulz boot crash Leonard Crestez
2019-12-10 21:49 ` [PATCH 1/2] ARM: imx: Fix boot crash if ocotp is not found Leonard Crestez
2019-12-11 10:25   ` Christoph Niedermaier [this message]
2019-12-12  2:44   ` Shawn Guo
2019-12-10 21:49 ` [PATCH 2/2] ARM: imx: Fix ocotp_compat for 6ull/6ulz Leonard Crestez
2019-12-10 21:53   ` Fabio Estevam
2019-12-10 23:00     ` Leonard Crestez
2019-12-11 10:34   ` Christoph Niedermaier
2019-12-11 12:19     ` Leonard Crestez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=516ff238856842b887d1d673d7e5dac6@dh-electronics.com \
    --to=cniedermaier@dh-electronics.com \
    --cc=Anson.Huang@nxp.com \
    --cc=aisheng.dong@nxp.com \
    --cc=fabio.estevam@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=leonard.crestez@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).