All of lore.kernel.org
 help / color / mirror / Atom feed
* re: [SCSI] pm80xx: Phy settings support for motherboard controller.
@ 2016-04-13 11:24 Dan Carpenter
  2016-04-14 12:52 ` Jack Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2016-04-13 11:24 UTC (permalink / raw)
  To: AnandKumar.Santhanam; +Cc: pmchba, linux-scsi

Hello Anand Kumar Santhanam,

The patch 279094079a44: "[SCSI] pm80xx: Phy settings support for
motherboard controller." from Sep 18, 2013, leads to the following
static checker warning:

	drivers/scsi/pm8001/pm80xx_hwi.c:4554 mpi_set_phy_profile_req()
	error: uninitialized symbol 'tag'.

drivers/scsi/pm8001/pm80xx_hwi.c
  4540  void mpi_set_phy_profile_req(struct pm8001_hba_info *pm8001_ha,
  4541          u32 operation, u32 phyid, u32 length, u32 *buf)
  4542  {
  4543          u32 tag , i, j = 0;
  4544          int rc;
  4545          struct set_phy_profile_req payload;
  4546          struct inbound_queue_table *circularQ;
  4547          u32 opc = OPC_INB_SET_PHY_PROFILE;
  4548  
  4549          memset(&payload, 0, sizeof(payload));
  4550          rc = pm8001_tag_alloc(pm8001_ha, &tag);
  4551          if (rc)
  4552                  PM8001_FAIL_DBG(pm8001_ha, pm8001_printk("Invalid tag\n"));
                                                                  ^^^^^^^^^^^^
Yup.

  4553          circularQ = &pm8001_ha->inbnd_q_tbl[0];
  4554          payload.tag = cpu_to_le32(tag);
                                          ^^^
Using invalid tag.

  4555          payload.ppc_phyid = (((operation & 0xF) << 8) | (phyid  & 0xFF));
  4556          PM8001_INIT_DBG(pm8001_ha,
  4557                  pm8001_printk(" phy profile command for phy %x ,length is %d\n",
  4558                          payload.ppc_phyid, length));
  4559          for (i = length; i < (length + PHY_DWORD_LENGTH - 1); i++) {
  4560                  payload.reserved[j] =  cpu_to_le32(*((u32 *)buf + i));
  4561                  j++;
  4562          }
  4563          rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
  4564          if (rc)
  4565                  pm8001_tag_free(pm8001_ha, tag);
  4566  }


regards,
dan carpenter

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

* Re: [SCSI] pm80xx: Phy settings support for motherboard controller.
  2016-04-13 11:24 [SCSI] pm80xx: Phy settings support for motherboard controller Dan Carpenter
@ 2016-04-14 12:52 ` Jack Wang
  2016-04-28  0:03   ` Martin K. Petersen
  0 siblings, 1 reply; 3+ messages in thread
From: Jack Wang @ 2016-04-14 12:52 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Anand Kumar Santhanam, pmchba, linux-scsi

[-- Attachment #1: Type: text/plain, Size: 448 bytes --]

2016-04-13 13:24 GMT+02:00 Dan Carpenter <dan.carpenter@oracle.com>:
> Hello Anand Kumar Santhanam,
>
> The patch 279094079a44: "[SCSI] pm80xx: Phy settings support for
> motherboard controller." from Sep 18, 2013, leads to the following
> static checker warning:
>
>         drivers/scsi/pm8001/pm80xx_hwi.c:4554 mpi_set_phy_profile_req()
>         error: uninitialized symbol 'tag'.
>
Thanks for reporting, attached patch should fix the warning.

[-- Attachment #2: 0001-pm80xx-avoid-to-use-invalid-tag.patch --]
[-- Type: text/x-diff, Size: 1510 bytes --]

From e30af801d9ee9979b2a7a2af815cb395c2255a09 Mon Sep 17 00:00:00 2001
From: Jack Wang <jinpu.wang@profitbricks.com>
Date: Thu, 14 Apr 2016 14:38:57 +0200
Subject: [PATCH] pm80xx: avoid to use invalid tag

Fix static checker warning:

drivers/scsi/pm8001/pm80xx_hwi.c:4554 mpi_set_phy_profile_req()
error: uninitialized symbol 'tag'.

Reported-by: Dan Carpenter dan.carpenter@oracle.com
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
---
 drivers/scsi/pm8001/pm80xx_hwi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index eb4fee6..a3c1c08 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -4548,8 +4548,10 @@ void mpi_set_phy_profile_req(struct pm8001_hba_info *pm8001_ha,
 
 	memset(&payload, 0, sizeof(payload));
 	rc = pm8001_tag_alloc(pm8001_ha, &tag);
-	if (rc)
+	if (rc) {
 		PM8001_FAIL_DBG(pm8001_ha, pm8001_printk("Invalid tag\n"));
+		return;
+	}
 	circularQ = &pm8001_ha->inbnd_q_tbl[0];
 	payload.tag = cpu_to_le32(tag);
 	payload.ppc_phyid = (((operation & 0xF) << 8) | (phyid  & 0xFF));
@@ -4590,8 +4592,10 @@ void pm8001_set_phy_profile_single(struct pm8001_hba_info *pm8001_ha,
 	memset(&payload, 0, sizeof(payload));
 
 	rc = pm8001_tag_alloc(pm8001_ha, &tag);
-	if (rc)
+	if (rc) {
 		PM8001_INIT_DBG(pm8001_ha, pm8001_printk("Invalid tag"));
+		return;
+	}
 
 	circularQ = &pm8001_ha->inbnd_q_tbl[0];
 	opc = OPC_INB_SET_PHY_PROFILE;
-- 
1.9.1


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

* Re: [SCSI] pm80xx: Phy settings support for motherboard controller.
  2016-04-14 12:52 ` Jack Wang
@ 2016-04-28  0:03   ` Martin K. Petersen
  0 siblings, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2016-04-28  0:03 UTC (permalink / raw)
  To: Jack Wang; +Cc: Dan Carpenter, Anand Kumar Santhanam, pmchba, linux-scsi

>>>>> "Jack" == Jack Wang <xjtuwjp@gmail.com> writes:

Jack> 2016-04-13 13:24 GMT+02:00 Dan Carpenter
Jack> <dan.carpenter@oracle.com>:
>> Hello Anand Kumar Santhanam,
>> 
>> The patch 279094079a44: "[SCSI] pm80xx: Phy settings support for
>> motherboard controller." from Sep 18, 2013, leads to the following
>> static checker warning:
>> 
>> drivers/scsi/pm8001/pm80xx_hwi.c:4554 mpi_set_phy_profile_req()
>> error: uninitialized symbol 'tag'.
>> 

Jack> Thanks for reporting, attached patch should fix the warning.

Dan: Please review Jack's patch so get can get this in.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2016-04-28  0:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-13 11:24 [SCSI] pm80xx: Phy settings support for motherboard controller Dan Carpenter
2016-04-14 12:52 ` Jack Wang
2016-04-28  0:03   ` Martin K. Petersen

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.