PCI: endpoint: pci-epf-{,v}ntb: fix a check for no epc alignment constraint
Subsystems (3)
PATCH 1/1 PCI: endpoint: pci-epf-{,v}ntb: fix a check for no epc alignment constraint
Some pci endpoint controllers has not alignment constraint, and the epc_features->align becomes 0. In this case, IS_ALIGNED() in epf_ntb_config_spad_bar_alloc() doesn't work well. So this patch adds the 0 checking before the IS_ALIGNED().
--- drivers/pci/endpoint/functions/pci-epf-ntb.c | 2 +- drivers/pci/endpoint/functions/pci-epf-vntb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/pci/endpoint/functions/pci-epf-ntb.c +1 -1
@@ -1021,7 +1021,7 @@ static int epf_ntb_config_spad_bar_alloc(struct epf_ntb *ntb, peer_size = peer_epc_features->bar_fixed_size[peer_barno];/* Check if epc_features is populated incorrectly */ -if ((!IS_ALIGNED (size, align))) +if (align && (!IS_ALIGNED (size, align)))return -EINVAL ; spad_count = ntb->spad_count;
drivers/pci/endpoint/functions/pci-epf-vntb.c +1 -1
@@ -418,7 +418,7 @@ static int epf_ntb_config_spad_bar_alloc(struct epf_ntb *ntb) size = epc_features->bar_fixed_size[barno]; align = epc_features->align; -if ((!IS_ALIGNED (size, align))) +if (align && !IS_ALIGNED (size, align))return -EINVAL ; spad_count = ntb->spad_count;
Signature · 1 line
2.17.1
Quoted 1 line · Shunsuke Mie
Some pci endpoint controllers has not alignment constraint, and the
s/pci/PCI/
s/has not/have no/
s/constraint/constraints/
Quoted 3 lines
epc_features->alignbecomes 0. In this case,IS_ALIGNED()inepf_ntb_config_spad_bar_alloc()doesn't work well. So this patch adds the 0 checking before theIS_ALIGNED().
s/So this patch adds .../Check for this before IS_ALIGNED()/
Quoted 35 lines
Signed-off-by Shunsuke Mie <[email protected]>--- drivers/pci/endpoint/functions/pci-epf-ntb.c | 2 +- drivers/pci/endpoint/functions/pci-epf-vntb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/pci/endpoint/functions/pci-epf-ntb.c +1
-1@@ -1021,7 +1021,7 @@ static int epf_ntb_config_spad_bar_alloc(struct epf_ntb *ntb, peer_size = peer_epc_features->bar_fixed_size[peer_barno];/* Check if epc_features is populated incorrectly */ -if ((!IS_ALIGNED (size, align))) +if (align && (!IS_ALIGNED (size, align)))return -EINVAL ; spad_count = ntb->spad_count;drivers/pci/endpoint/functions/pci-epf-vntb.c +1
-1@@ -418,7 +418,7 @@ static int epf_ntb_config_spad_bar_alloc(struct epf_ntb *ntb) size = epc_features->bar_fixed_size[barno]; align = epc_features->align; -if ((!IS_ALIGNED (size, align))) +if (align && !IS_ALIGNED (size, align))return -EINVAL ; spad_count = ntb->spad_count;Signature · 1 line
2.17.1
2022年9月20日(火) 3:55 Bjorn Helgaas <[email protected]>:
Quoted 8 lines · Shunsuke Mie
Quoted 1 line
Some pci endpoint controllers has not alignment constraint, and the
s/pci/PCI/
s/has not/have no/
s/constraint/constraints/
Quoted 5 lines
Quoted 3 lines
epc_features->alignbecomes 0. In this case,IS_ALIGNED()inepf_ntb_config_spad_bar_alloc()doesn't work well. So this patch adds the 0 checking before theIS_ALIGNED().s/So this patch adds .../Check for this before IS_ALIGNED()/
Thank you. I'll fix these.
Quoted 28 lines
Quoted 28 lines
Signed-off-by Shunsuke Mie <[email protected]>--- drivers/pci/endpoint/functions/pci-epf-ntb.c | 2 +- drivers/pci/endpoint/functions/pci-epf-vntb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/pci/endpoint/functions/pci-epf-ntb.c +1
-1@@ -1021,7 +1021,7 @@ static int epf_ntb_config_spad_bar_alloc(struct epf_ntb *ntb, peer_size = peer_epc_features->bar_fixed_size[peer_barno];/* Check if epc_features is populated incorrectly */ -if ((!IS_ALIGNED (size, align))) +if (align && (!IS_ALIGNED (size, align)))return -EINVAL ; spad_count = ntb->spad_count;drivers/pci/endpoint/functions/pci-epf-vntb.c +0
-0@@ -418,7 +418,7 @@ static int epf_ntb_config_spad_bar_alloc(struct epf_ntb *ntb) size = epc_features->bar_fixed_size[barno]; align = epc_features->align;
Quoted 8 lines
Quoted 8 lines
drivers/pci/endpoint/functions/pci-epf-vntb.c +1
-2-if ((!IS_ALIGNED (size, align))) +if (align && !IS_ALIGNED (size, align))return -EINVAL ; spad_count = ntb->spad_count; --2.17.1
Best,
Shunsuke