From: Nicholas Mc Guire <hofrat@osadl.org> To: Russell King <linux@armlinux.org.uk> Cc: Shawn Guo <shawnguo@kernel.org>, Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix Kernel Team <kernel@pengutronix.de>, Fabio Estevam <festevam@gmail.com>, NXP Linux Team <linux-imx@nxp.com>, Mark Brown <broonie@kernel.org>, Linus Walleij <linus.walleij@linaro.org>, Tony Lindgren <tony@atomide.com>, Mike Rapoport <rppt@linux.vnet.ibm.com>, Janusz Krzysztofik <jmkrzyszt@gmail.com>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire <hofrat@osadl.org> Subject: [PATCH 1/4 RFC] ARM: imx legacy: warn on failed allocation Date: Sat, 13 Apr 2019 09:23:30 +0200 [thread overview] Message-ID: <1555140213-1081-2-git-send-email-hofrat@osadl.org> (raw) In-Reply-To: <1555140213-1081-1-git-send-email-hofrat@osadl.org> Even in init the allocation can fail and thus should at least warn so that the cause can be identified. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> --- Problem located with an experimental coccinelle script Note sure if there is a better solution as this is early in the boot process so not that could be done anyway but fuss - anyway unchecked allocation is not a good thing. Patch was compile-tested with: imx_v4_v5_defconfig (implies CONFIG_MACH_MX27ADS=y) (with some unrelated sparse warnings about unimplemented syscalls and a few checkpatch warnings - covered in the other patches) Patch is against 5.1-rc4 (localversion-next is 20190412) arch/arm/mach-imx/mach-mx27ads.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c index 6dd7f57..528846f 100644 --- a/arch/arm/mach-imx/mach-mx27ads.c +++ b/arch/arm/mach-imx/mach-mx27ads.c @@ -247,6 +247,7 @@ static void __init mx27ads_regulator_init(void) struct gpio_chip *vchip; vchip = kzalloc(sizeof(*vchip), GFP_KERNEL); + WARN_ON(!vchip); vchip->owner = THIS_MODULE; vchip->label = "LCD"; vchip->base = MX27ADS_LCD_GPIO; -- 2.1.4
WARNING: multiple messages have this Message-ID (diff)
From: Nicholas Mc Guire <hofrat@osadl.org> To: Russell King <linux@armlinux.org.uk> Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>, Tony Lindgren <tony@atomide.com>, Shawn Guo <shawnguo@kernel.org>, Sascha Hauer <s.hauer@pengutronix.de>, Janusz Krzysztofik <jmkrzyszt@gmail.com>, linux-kernel@vger.kernel.org, Mark Brown <broonie@kernel.org>, NXP Linux Team <linux-imx@nxp.com>, Pengutronix Kernel Team <kernel@pengutronix.de>, Nicholas Mc Guire <hofrat@osadl.org>, Fabio Estevam <festevam@gmail.com>, Linus Walleij <linus.walleij@linaro.org>, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/4 RFC] ARM: imx legacy: warn on failed allocation Date: Sat, 13 Apr 2019 09:23:30 +0200 [thread overview] Message-ID: <1555140213-1081-2-git-send-email-hofrat@osadl.org> (raw) In-Reply-To: <1555140213-1081-1-git-send-email-hofrat@osadl.org> Even in init the allocation can fail and thus should at least warn so that the cause can be identified. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> --- Problem located with an experimental coccinelle script Note sure if there is a better solution as this is early in the boot process so not that could be done anyway but fuss - anyway unchecked allocation is not a good thing. Patch was compile-tested with: imx_v4_v5_defconfig (implies CONFIG_MACH_MX27ADS=y) (with some unrelated sparse warnings about unimplemented syscalls and a few checkpatch warnings - covered in the other patches) Patch is against 5.1-rc4 (localversion-next is 20190412) arch/arm/mach-imx/mach-mx27ads.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c index 6dd7f57..528846f 100644 --- a/arch/arm/mach-imx/mach-mx27ads.c +++ b/arch/arm/mach-imx/mach-mx27ads.c @@ -247,6 +247,7 @@ static void __init mx27ads_regulator_init(void) struct gpio_chip *vchip; vchip = kzalloc(sizeof(*vchip), GFP_KERNEL); + WARN_ON(!vchip); vchip->owner = THIS_MODULE; vchip->label = "LCD"; vchip->base = MX27ADS_LCD_GPIO; -- 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-04-13 7:30 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-13 7:23 [PATCH 0/4] ARM: imx legacy: cleanups Nicholas Mc Guire 2019-04-13 7:23 ` Nicholas Mc Guire 2019-04-13 7:23 ` Nicholas Mc Guire [this message] 2019-04-13 7:23 ` [PATCH 1/4 RFC] ARM: imx legacy: warn on failed allocation Nicholas Mc Guire 2019-04-13 7:23 ` [PATCH 2/4] ARM: imx legacy: declare unsigned int rather than unsigned Nicholas Mc Guire 2019-04-13 7:23 ` Nicholas Mc Guire 2019-04-13 7:23 ` [PATCH 3/4 RFC] ARM: imx legacy: wrap complex macro in () Nicholas Mc Guire 2019-04-13 7:23 ` Nicholas Mc Guire 2019-04-13 7:23 ` [PATCH 4/4] ARM: imx legacy: add an SPDX license identifier Nicholas Mc Guire 2019-04-13 7:23 ` Nicholas Mc Guire 2019-04-13 14:11 ` Fabio Estevam 2019-04-13 14:11 ` Fabio Estevam 2019-04-13 23:54 ` Nicholas Mc Guire 2019-04-13 23:54 ` Nicholas Mc Guire -- strict thread matches above, loose matches on Subject: below -- 2019-04-13 7:14 [PATCH 0/4] ARM: imx legacy: cleanups Nicholas Mc Guire 2019-04-13 7:14 ` [PATCH 1/4 RFC] ARM: imx legacy: warn on failed allocation Nicholas Mc Guire 2019-04-13 7:14 ` Nicholas Mc Guire
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=1555140213-1081-2-git-send-email-hofrat@osadl.org \ --to=hofrat@osadl.org \ --cc=broonie@kernel.org \ --cc=festevam@gmail.com \ --cc=jmkrzyszt@gmail.com \ --cc=kernel@pengutronix.de \ --cc=linus.walleij@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-imx@nxp.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@armlinux.org.uk \ --cc=rppt@linux.vnet.ibm.com \ --cc=s.hauer@pengutronix.de \ --cc=shawnguo@kernel.org \ --cc=tony@atomide.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.