mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: bnx2i: add error handling for ioremap_nocache
@ 2018-06-12  3:13 Zhouyang Jia
  2018-06-12  7:50 ` Rangankar, Manish
  0 siblings, 1 reply; 2+ messages in thread
From: Zhouyang Jia @ 2018-06-12  3:13 UTC (permalink / raw)
  Cc: Zhouyang Jia, QLogic-Storage-Upstream, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel

When ioremap_nocache fails, the lack of error-handling code may
cause unexpected results.

This patch adds error-handling code after calling ioremap_nocache.

Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>
---
 drivers/scsi/bnx2i/bnx2i_hwi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index 8f03a86..e9e669a 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -2727,6 +2727,8 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint *ep)
 					      BNX2X_DOORBELL_PCI_BAR);
 		reg_off = (1 << BNX2X_DB_SHIFT) * (cid_num & 0x1FFFF);
 		ep->qp.ctx_base = ioremap_nocache(reg_base + reg_off, 4);
+		if (!ep->qp.ctx_base)
+			return -ENOMEM;
 		goto arm_cq;
 	}
 
-- 
2.7.4


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

* RE: [PATCH] scsi: bnx2i: add error handling for ioremap_nocache
  2018-06-12  3:13 [PATCH] scsi: bnx2i: add error handling for ioremap_nocache Zhouyang Jia
@ 2018-06-12  7:50 ` Rangankar, Manish
  0 siblings, 0 replies; 2+ messages in thread
From: Rangankar, Manish @ 2018-06-12  7:50 UTC (permalink / raw)
  To: Zhouyang Jia
  Cc: Dept-Eng QLogic Storage Upstream, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel


> -----Original Message-----
> From: Zhouyang Jia <jiazhouyang09@gmail.com>
> Sent: Tuesday, June 12, 2018 8:43 AM
> Cc: Zhouyang Jia <jiazhouyang09@gmail.com>; Dept-Eng QLogic Storage
> Upstream <QLogic-Storage-Upstream@cavium.com>; James E.J. Bottomley
> <jejb@linux.vnet.ibm.com>; Martin K. Petersen <martin.petersen@oracle.com>;
> linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH] scsi: bnx2i: add error handling for ioremap_nocache
> 
> When ioremap_nocache fails, the lack of error-handling code may cause
> unexpected results.
> 
> This patch adds error-handling code after calling ioremap_nocache.
> 
> Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>
> ---
>  drivers/scsi/bnx2i/bnx2i_hwi.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c index
> 8f03a86..e9e669a 100644
> --- a/drivers/scsi/bnx2i/bnx2i_hwi.c
> +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
> @@ -2727,6 +2727,8 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint
> *ep)
>  					      BNX2X_DOORBELL_PCI_BAR);
>  		reg_off = (1 << BNX2X_DB_SHIFT) * (cid_num & 0x1FFFF);
>  		ep->qp.ctx_base = ioremap_nocache(reg_base + reg_off, 4);
> +		if (!ep->qp.ctx_base)
> +			return -ENOMEM;
>  		goto arm_cq;
>  	}
> 
> --
> 2.7.4

Thanks,

Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>

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

end of thread, other threads:[~2018-06-12  7:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-12  3:13 [PATCH] scsi: bnx2i: add error handling for ioremap_nocache Zhouyang Jia
2018-06-12  7:50 ` Rangankar, Manish

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®