All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] microblaze: warn if of_iomap() failed
@ 2018-07-09  8:42 ` Nicholas Mc Guire
  0 siblings, 0 replies; 4+ messages in thread
From: Nicholas Mc Guire @ 2018-07-09  8:42 UTC (permalink / raw)
  To: Michal Simek; +Cc: linux-arm-kernel, linux-kernel, Nicholas Mc Guire

of_iomap() can return NULL. The function is void thus error propagation
is not possible but at least a WARN_ON() seems warranted here as a silent
failure might lead to a hard to understand system state.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

Problem located with experimental coccinelle script

Probably this should be a BUG_ON() as this is such a low level fault that
continuing operations probably makes little sense.

Patch was compiletested with: mmu_defconfig (implies CONFIG_PCI_XILINX=y)

Patch is against 4.18-rc3 (localversion-next is next-20180709)

 arch/microblaze/pci/xilinx_pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/microblaze/pci/xilinx_pci.c b/arch/microblaze/pci/xilinx_pci.c
index 14c7da5f..7fa72ff 100644
--- a/arch/microblaze/pci/xilinx_pci.c
+++ b/arch/microblaze/pci/xilinx_pci.c
@@ -157,6 +157,7 @@ void __init xilinx_pci_init(void)
 
 	/* Set the max bus number to 255, and bus/subbus no's to 0 */
 	pci_reg = of_iomap(pci_node, 0);
+	WARN_ON(!pci_reg);
 	out_be32(pci_reg + XPLB_PCI_BUS, 0x000000ff);
 	iounmap(pci_reg);
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] microblaze: warn if of_iomap() failed
@ 2018-07-09  8:42 ` Nicholas Mc Guire
  0 siblings, 0 replies; 4+ messages in thread
From: Nicholas Mc Guire @ 2018-07-09  8:42 UTC (permalink / raw)
  To: linux-arm-kernel

of_iomap() can return NULL. The function is void thus error propagation
is not possible but at least a WARN_ON() seems warranted here as a silent
failure might lead to a hard to understand system state.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

Problem located with experimental coccinelle script

Probably this should be a BUG_ON() as this is such a low level fault that
continuing operations probably makes little sense.

Patch was compiletested with: mmu_defconfig (implies CONFIG_PCI_XILINX=y)

Patch is against 4.18-rc3 (localversion-next is next-20180709)

 arch/microblaze/pci/xilinx_pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/microblaze/pci/xilinx_pci.c b/arch/microblaze/pci/xilinx_pci.c
index 14c7da5f..7fa72ff 100644
--- a/arch/microblaze/pci/xilinx_pci.c
+++ b/arch/microblaze/pci/xilinx_pci.c
@@ -157,6 +157,7 @@ void __init xilinx_pci_init(void)
 
 	/* Set the max bus number to 255, and bus/subbus no's to 0 */
 	pci_reg = of_iomap(pci_node, 0);
+	WARN_ON(!pci_reg);
 	out_be32(pci_reg + XPLB_PCI_BUS, 0x000000ff);
 	iounmap(pci_reg);
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] microblaze: warn if of_iomap() failed
  2018-07-09  8:42 ` Nicholas Mc Guire
@ 2018-07-11  8:07   ` Michal Simek
  -1 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2018-07-11  8:07 UTC (permalink / raw)
  To: Nicholas Mc Guire; +Cc: linux-kernel, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1536 bytes --]

On 9.7.2018 10:42, Nicholas Mc Guire wrote:
> of_iomap() can return NULL. The function is void thus error propagation
> is not possible but at least a WARN_ON() seems warranted here as a silent
> failure might lead to a hard to understand system state.
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> ---
> 
> Problem located with experimental coccinelle script
> 
> Probably this should be a BUG_ON() as this is such a low level fault that
> continuing operations probably makes little sense.
> 
> Patch was compiletested with: mmu_defconfig (implies CONFIG_PCI_XILINX=y)
> 
> Patch is against 4.18-rc3 (localversion-next is next-20180709)
> 
>  arch/microblaze/pci/xilinx_pci.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/microblaze/pci/xilinx_pci.c b/arch/microblaze/pci/xilinx_pci.c
> index 14c7da5f..7fa72ff 100644
> --- a/arch/microblaze/pci/xilinx_pci.c
> +++ b/arch/microblaze/pci/xilinx_pci.c
> @@ -157,6 +157,7 @@ void __init xilinx_pci_init(void)
>  
>  	/* Set the max bus number to 255, and bus/subbus no's to 0 */
>  	pci_reg = of_iomap(pci_node, 0);
> +	WARN_ON(!pci_reg);
>  	out_be32(pci_reg + XPLB_PCI_BUS, 0x000000ff);
>  	iounmap(pci_reg);
>  
> 

Applied.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP SoCs



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] microblaze: warn if of_iomap() failed
@ 2018-07-11  8:07   ` Michal Simek
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2018-07-11  8:07 UTC (permalink / raw)
  To: linux-arm-kernel

On 9.7.2018 10:42, Nicholas Mc Guire wrote:
> of_iomap() can return NULL. The function is void thus error propagation
> is not possible but at least a WARN_ON() seems warranted here as a silent
> failure might lead to a hard to understand system state.
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> ---
> 
> Problem located with experimental coccinelle script
> 
> Probably this should be a BUG_ON() as this is such a low level fault that
> continuing operations probably makes little sense.
> 
> Patch was compiletested with: mmu_defconfig (implies CONFIG_PCI_XILINX=y)
> 
> Patch is against 4.18-rc3 (localversion-next is next-20180709)
> 
>  arch/microblaze/pci/xilinx_pci.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/microblaze/pci/xilinx_pci.c b/arch/microblaze/pci/xilinx_pci.c
> index 14c7da5f..7fa72ff 100644
> --- a/arch/microblaze/pci/xilinx_pci.c
> +++ b/arch/microblaze/pci/xilinx_pci.c
> @@ -157,6 +157,7 @@ void __init xilinx_pci_init(void)
>  
>  	/* Set the max bus number to 255, and bus/subbus no's to 0 */
>  	pci_reg = of_iomap(pci_node, 0);
> +	WARN_ON(!pci_reg);
>  	out_be32(pci_reg + XPLB_PCI_BUS, 0x000000ff);
>  	iounmap(pci_reg);
>  
> 

Applied.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP SoCs


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180711/80fdbad9/attachment.sig>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-11  8:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-09  8:42 [PATCH] microblaze: warn if of_iomap() failed Nicholas Mc Guire
2018-07-09  8:42 ` Nicholas Mc Guire
2018-07-11  8:07 ` Michal Simek
2018-07-11  8:07   ` Michal Simek

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.