Subject: linux-next: manual merge of the scsi-mkp tree with Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Fri, 3 Aug 2018 16:04:05 +1000

Hi all,

Today's linux-next merge of the scsi-mkp tree got conflicts in:

  drivers/scsi/qla2xxx/qla_gs.c

between commit:

  b5f3bc39a0e8 ("scsi: qla2xxx: Fix inconsistent DMA mem alloc/free")

from Linus' tree and commit:

  8777e4314d39 ("scsi: qla2xxx: Migrate NVME N2N handling into state machine")

from the scsi-mkp tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

P.S. it looks like more use could be made of "c" in this function ...

diff --cc drivers/scsi/qla2xxx/qla_gs.c
index 7a3744006419,407eb705f1be..000000000000
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@@ -3394,19 -3383,40 +3391,40 @@@ int qla24xx_post_gpnid_work(struct scsi
  
  void qla24xx_sp_unmap(scsi_qla_host_t *vha, srb_t *sp)
  {
- 	if (sp->u.iocb_cmd.u.ctarg.req) {
- 		dma_free_coherent(&vha->hw->pdev->dev,
- 			sp->u.iocb_cmd.u.ctarg.req_allocated_size,
- 			sp->u.iocb_cmd.u.ctarg.req,
- 			sp->u.iocb_cmd.u.ctarg.req_dma);
- 		sp->u.iocb_cmd.u.ctarg.req = NULL;
- 	}
- 	if (sp->u.iocb_cmd.u.ctarg.rsp) {
- 		dma_free_coherent(&vha->hw->pdev->dev,
- 			sp->u.iocb_cmd.u.ctarg.rsp_allocated_size,
- 			sp->u.iocb_cmd.u.ctarg.rsp,
- 			sp->u.iocb_cmd.u.ctarg.rsp_dma);
- 		sp->u.iocb_cmd.u.ctarg.rsp = NULL;
+ 	struct srb_iocb *c = &sp->u.iocb_cmd;
+ 
+ 	switch (sp->type) {
+ 	case SRB_ELS_DCMD:
+ 		if (c->u.els_plogi.els_plogi_pyld)
+ 			dma_free_coherent(&vha->hw->pdev->dev,
+ 			    c->u.els_plogi.tx_size,
+ 			    c->u.els_plogi.els_plogi_pyld,
+ 			    c->u.els_plogi.els_plogi_pyld_dma);
+ 
+ 		if (c->u.els_plogi.els_resp_pyld)
+ 			dma_free_coherent(&vha->hw->pdev->dev,
+ 			    c->u.els_plogi.rx_size,
+ 			    c->u.els_plogi.els_resp_pyld,
+ 			    c->u.els_plogi.els_resp_pyld_dma);
+ 		break;
+ 	case SRB_CT_PTHRU_CMD:
+ 	default:
+ 		if (sp->u.iocb_cmd.u.ctarg.req) {
+ 			dma_free_coherent(&vha->hw->pdev->dev,
 -			    sizeof(struct ct_sns_pkt),
++			    sp->u.iocb_cmd.u.ctarg.req_allocated_size,
+ 			    sp->u.iocb_cmd.u.ctarg.req,
+ 			    sp->u.iocb_cmd.u.ctarg.req_dma);
+ 			sp->u.iocb_cmd.u.ctarg.req = NULL;
+ 		}
+ 
+ 		if (sp->u.iocb_cmd.u.ctarg.rsp) {
+ 			dma_free_coherent(&vha->hw->pdev->dev,
 -			    sizeof(struct ct_sns_pkt),
++			    sp->u.iocb_cmd.u.ctarg.rsp_allocated_size,
+ 			    sp->u.iocb_cmd.u.ctarg.rsp,
+ 			    sp->u.iocb_cmd.u.ctarg.rsp_dma);
+ 			sp->u.iocb_cmd.u.ctarg.rsp = NULL;
+ 		}
+ 		break;
  	}
  
  	sp->free(sp);