[PATCH 1/4] pinctrl: dove: Prevent NULL dereference if of_match_device returns NULL
From: Axel Lin <hidden>
Date: 2012-11-15 13:44:07
Subsystem:
arm port, the rest · Maintainers:
Russell King, Linus Torvalds
2012/11/15 Thomas Petazzoni [off-list ref]
Dear Axel Lin, On Thu, 15 Nov 2012 12:51:36 +0800, Axel Lin wrote:quoted
of_match_device() may return NULL. Signed-off-by: Axel Lin <redacted>Could you detail under what conditions of_match_device() may return NULL in the specific case of this driver? This of_match_device() call is using the same dove_pinctrl_of_match array that is used to ->probe() this driver. So I don't see how you can get into ->probe() without having a matching entry. Am I missing something?
hi Thomas, You are right. I was thinking when the case CONFIG_OF is not selected, of_match_ptr(dove_pinctrl_of_match) is NULL and of_match_device returns NULL. But this driver only works when CONFIG_OF is selected. BTW, I found there is no way to compile the dove and kirkwood pinctrl drivers. I need add below patch to compile these two drivers, how do you think about below patch? ( In dove, the USE_OF is optional, it is selected only when MACH_DOVE_DT is enabled )
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 14f8160..dda6785 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig@@ -531,6 +531,8 @@ config ARCH_DOVE select CPU_V7 select GENERIC_CLOCKEVENTS select MIGHT_HAVE_PCI + select PINCTRL + select PINCTRL_DOVE if USE_OF select PLAT_ORION_LEGACY select USB_ARCH_HAS_EHCI help
@@ -542,6 +544,8 @@ config ARCH_KIRKWOOD select CPU_FEROCEON select GENERIC_CLOCKEVENTS select PCI + select PINCTRL + select PINCTRL_KIRKWOOD select PLAT_ORION_LEGACY help Support for the following Marvell Kirkwood series SoCs:
Regards, Axel -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121115/be2e1627/attachment-0001.html>