* [PATCH] scsi: hisi_sas: redefine hisi_sas_phy.phy_type as u32
@ 2017-06-26 10:27 John Garry
2017-06-26 17:41 ` Martin K. Petersen
0 siblings, 1 reply; 2+ messages in thread
From: John Garry @ 2017-06-26 10:27 UTC (permalink / raw)
To: jejb, martin.petersen
Cc: linuxarm, linux-scsi, linux-kernel, dan.carpenter, John Garry
Element phy_type is a bitmask and it only ever has 2
bits possibly set, and it is overkill to define as a u64,
so redefine as a u32.
This change resolves static code check complaint that
"phy->phy_type &= ~PORT_TYPE_SAS;" would
unintentionally clear the high 32 bits as well.
Structure hisi_sas_phy is also reordered to ensure
packing efficiency.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: John Garry <john.garry@huawei.com>
diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
index 4fc2308..22dd48b 100644
--- a/drivers/scsi/hisi_sas/hisi_sas.h
+++ b/drivers/scsi/hisi_sas/hisi_sas.h
@@ -85,11 +85,11 @@ struct hisi_sas_phy {
struct work_struct phyup_ws;
u64 port_id; /* from hw */
u64 dev_sas_addr;
- u64 phy_type;
u64 frame_rcvd_size;
u8 frame_rcvd[32];
u8 phy_attached;
u8 reserved[3];
+ u32 phy_type;
enum sas_linkrate minimum_linkrate;
enum sas_linkrate maximum_linkrate;
};
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: hisi_sas: redefine hisi_sas_phy.phy_type as u32
2017-06-26 10:27 [PATCH] scsi: hisi_sas: redefine hisi_sas_phy.phy_type as u32 John Garry
@ 2017-06-26 17:41 ` Martin K. Petersen
0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2017-06-26 17:41 UTC (permalink / raw)
To: John Garry
Cc: jejb, martin.petersen, linuxarm, linux-scsi, linux-kernel, dan.carpenter
John,
> Element phy_type is a bitmask and it only ever has 2 bits possibly
> set, and it is overkill to define as a u64, so redefine as a u32.
>
> This change resolves static code check complaint that "phy->phy_type
> &= ~PORT_TYPE_SAS;" would unintentionally clear the high 32 bits as
> well.
>
> Structure hisi_sas_phy is also reordered to ensure packing efficiency.
Applied to 4.13/scsi-queue, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-26 17:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-26 10:27 [PATCH] scsi: hisi_sas: redefine hisi_sas_phy.phy_type as u32 John Garry
2017-06-26 17:41 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).