lkml.org 
[lkml]   [2019]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/4 RFC] ARM: imx legacy: warn on failed allocation
Date
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
\
 
 \ /
  Last update: 2019-04-13 09:22    [W:0.100 / U:0.700 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site