[PATCH] ARM: mmp: fix potential NULL dereference

Yuanhan Liu yliu.null at gmail.com
Wed Aug 8 05:02:08 EDT 2012


Fix the wrong logic: we should use || instead of &&

Cc: Leo Yan <leoy at marvell.com>
Cc: Haojian Zhuang <haojian.zhuang at gmail.com>
Cc: Eric Miao <eric.y.miao at gmail.com>
Signed-off-by: Yuanhan Liu <yliu.null at gmail.com>
---
 arch/arm/mach-mmp/sram.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-mmp/sram.c b/arch/arm/mach-mmp/sram.c
index 4304f95..7e8a5a2 100644
--- a/arch/arm/mach-mmp/sram.c
+++ b/arch/arm/mach-mmp/sram.c
@@ -68,7 +68,7 @@ static int __devinit sram_probe(struct platform_device *pdev)
 	struct resource *res;
 	int ret = 0;
 
-	if (!pdata && !pdata->pool_name)
+	if (!pdata || !pdata->pool_name)
 		return -ENODEV;
 
 	info = kzalloc(sizeof(*info), GFP_KERNEL);
-- 
1.7.4.4




More information about the linux-arm-kernel mailing list