* [PATCH v3] PCI: qcom: Use __be16 type to store return value from cpu_to_be16()
@ 2021-11-30 8:09 Manivannan Sadhasivam
2021-12-06 10:31 ` Lorenzo Pieralisi
0 siblings, 1 reply; 2+ messages in thread
From: Manivannan Sadhasivam @ 2021-11-30 8:09 UTC (permalink / raw)
To: lorenzo.pieralisi, bhelgaas
Cc: svarbanov, bjorn.andersson, robh, linux-pci, linux-arm-msm,
linux-kernel, Manivannan Sadhasivam, kernel test robot,
Krzysztof Wilczyński
cpu_to_be16() returns __be16 value but the driver uses u16 and that's
incorrect. Fix it by using __be16 as the data type of bdf_be variable.
The issue was spotted by the below sparse warning:
sparse warnings: (new ones prefixed by >>)
>> drivers/pci/controller/dwc/pcie-qcom.c:1305:30: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned short [usertype] bdf_be @@ got restricted __be16 [usertype] @@
drivers/pci/controller/dwc/pcie-qcom.c:1305:30: sparse: expected unsigned short [usertype] bdf_be
drivers/pci/controller/dwc/pcie-qcom.c:1305:30: sparse: got restricted __be16 [usertype]
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Krzysztof Wilczyński <kw@linux.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
Changes in v3:
* Added Krzysztof's reviewed-by tag and modified the commit message as per
his comments
Changes in v2:
* Modified the commit message and subject to describe the actual issue
as per comments from Bjorn.
drivers/pci/controller/dwc/pcie-qcom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 1c3d1116bb60..ddecd7f341c5 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1343,7 +1343,7 @@ static int qcom_pcie_config_sid_sm8250(struct qcom_pcie *pcie)
/* Look for an available entry to hold the mapping */
for (i = 0; i < nr_map; i++) {
- u16 bdf_be = cpu_to_be16(map[i].bdf);
+ __be16 bdf_be = cpu_to_be16(map[i].bdf);
u32 val;
u8 hash;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] PCI: qcom: Use __be16 type to store return value from cpu_to_be16()
2021-11-30 8:09 [PATCH v3] PCI: qcom: Use __be16 type to store return value from cpu_to_be16() Manivannan Sadhasivam
@ 2021-12-06 10:31 ` Lorenzo Pieralisi
0 siblings, 0 replies; 2+ messages in thread
From: Lorenzo Pieralisi @ 2021-12-06 10:31 UTC (permalink / raw)
To: Manivannan Sadhasivam, bhelgaas
Cc: Lorenzo Pieralisi, robh, linux-kernel, linux-arm-msm,
Krzysztof Wilczyński, linux-pci, svarbanov,
kernel test robot, bjorn.andersson
On Tue, 30 Nov 2021 13:39:24 +0530, Manivannan Sadhasivam wrote:
> cpu_to_be16() returns __be16 value but the driver uses u16 and that's
> incorrect. Fix it by using __be16 as the data type of bdf_be variable.
>
> The issue was spotted by the below sparse warning:
>
> sparse warnings: (new ones prefixed by >>)
> >> drivers/pci/controller/dwc/pcie-qcom.c:1305:30: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned short [usertype] bdf_be @@ got restricted __be16 [usertype] @@
> drivers/pci/controller/dwc/pcie-qcom.c:1305:30: sparse: expected unsigned short [usertype] bdf_be
> drivers/pci/controller/dwc/pcie-qcom.c:1305:30: sparse: got restricted __be16 [usertype]
>
> [...]
Applied to pci/qcom, thanks!
[1/1] PCI: qcom: Use __be16 type to store return value from cpu_to_be16()
https://git.kernel.org/lpieralisi/pci/c/3f13d611aa
Thanks,
Lorenzo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-06 10:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 8:09 [PATCH v3] PCI: qcom: Use __be16 type to store return value from cpu_to_be16() Manivannan Sadhasivam
2021-12-06 10:31 ` Lorenzo Pieralisi
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.