ahci_xgene: Fix the error print invalid resource for APM X-Gene SoC AHCI SATA Host Controller driver.
PATCH 1/1 ahci_xgene: Fix the error print invalid resource for APM X-Gene SoC AHCI SATA Host Controller driver.
---
Suman Tripathi (1):
ahci_xgene: Fix the error print invalid resource for APM X-Gene SoC
AHCI SATA Host Controller driver.
drivers/ata/ahci_xgene.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
--
1.8.2.1
PATCH 1/1 ahci_xgene: Fix the error print invalid resource for APM X-Gene SoC AHCI SATA Host Controller driver.
This patch fixes the error print invalid resource for the APM X-Gene SoC AHCI SATA Host Controller driver. This print was due to the fact that the controller 3 don't have a mux resource. This didn't result in any errors but the print seems like meaningless.
--- drivers/ata/ahci_xgene.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ata/ahci_xgene.c +2 -2
@@ -434,7 +434,7 @@ static int xgene_ahci_mux_select(struct xgene_ahci_context *ctx)u32 val;/* Check for optional MUX resource */ -if (IS_ERR (ctx->csr_mux)) +if (!ctx->csr_mux)return 0 ; val =readl (ctx->csr_mux +SATA_ENET_CONFIG_REG );
@@ -485,7 +485,7 @@ static int xgene_ahci_probe(struct platform_device *pdev)/* Retrieve the optional IP mux resource */ res =platform_get_resource (pdev,IORESOURCE_MEM ,4 ); - ctx->csr_mux =devm_ioremap_resource (dev, res); + ctx->csr_mux = res ?devm_ioremap_resource (dev, res) :NULL ;dev_dbg (dev,"VAddr 0x%p Mmio VAddr 0x%p\n" , ctx->csr_core, hpriv->mmio);
--
1.8.2.1
PATCH 1/1 ahci_xgene: Fix the error print invalid resource for APM X-Gene SoC AHCI SATA Host Controller driver.
Quoted 16 lines · Suman Tripathi
This patch fixes the error print invalid resource for the APM X-Gene SoC AHCI SATA Host Controller driver. This print was due to the fact that the controller 3 don't have a mux resource. This didn't result in any errors but the print seems like meaningless.
Signed-off-by Loc Ho <[email protected]>Signed-off-by Suman Tripathi <[email protected]>--- drivers/ata/ahci_xgene.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/ata/ahci_xgene.c +0
-0
drivers/ata/ahci_xgene.c static int xgene_ahci_mux_select(struct xgene_ahci_context *ctx) · line 438
Quoted 6 lines
drivers/ata/ahci_xgene.c +1
-1@@ -434,7 +434,7 @@ static int xgene_ahci_mux_select(struct xgene_ahci_context *ctx)u32 val;/* Check for optional MUX resource */ -if (IS_ERR (ctx->csr_mux)) +if (!ctx->csr_mux)return 0 ;
Hmmm? So, if devm_ioremap_resource() call actually fails, now the function tries to operation on ERR_PTR() value as a real pointer?
Thanks.
Signature · 1 line
tejun
A message that is not in the archive (sent off-list or not yet received): CAOHikRA8LiNkMuzqe-Kgrf4QWbJ_jpXRGHdf+rsrCmq6R0GjDg@mail.gmail.com
PATCH 1/1 ahci_xgene: Fix the error print invalid resource for APM X-Gene SoC AHCI SATA Host Controller driver.
Hello,
Quoted 4 lines · Suman Tripathi
We can maintain same piece (
IS_ERR(ctx->csr_mux)), then we can do the below instead of NULL ??
ctx->csr_mux= res ?devm_ioremap_resource(dev, res):ERR_PTR(-EINVAL);
Setting it to NULL on failure would probably make more sense. No need to carry around ERR_PTR() value around.
Thanks.
Signature · 1 line
tejun
A message that is not in the archive (sent off-list or not yet received): CAOHikRAFM-FETGGXroNV39Yi-jChMA-W37ufhiMx4O2WgWpxFg@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): CAOHikRDdfKTxCXHGsywP+c8=1eLmMCf3fuC2pmH2WH-6ymHMAA@mail.gmail.com
PATCH 1/1 ahci_xgene: Fix the error print invalid resource for APM X-Gene SoC AHCI SATA Host Controller driver.
Quoted 2 lines · Suman Tripathi
[suman] : So the posted version is acceptable ? Any others comments on this patch ?
I'm suggesting setting ctx->cs_mux to NULL on failure. IOW,
if (res) {
ctx->csr_mux = devm_ioremap_resources();
if (IS_ERR(ctx->csr_mux)) {
print warning or something;
ctx->csr_mux = NULL;
}
}Thanks.
Signature · 1 line
tejun
PATCH 1/1 ahci_xgene: Fix the error print invalid resource for APM X-Gene SoC AHCI SATA Host Controller driver.
Quoted 6 lines · Tejun Heo
Quoted 2 lines · Suman Tripathi
[suman] : So the posted version is acceptable ? Any others comments on this patch ?
I'm suggesting setting
ctx->cs_muxto NULL on failure. IOW,
Quoted 7 lines
if (res) {
ctx->csr_mux = devm_ioremap_resources();
if (IS_ERR(ctx->csr_mux)) {
print warning or something;
ctx->csr_mux = NULL;
}
}A much better approach is:
if (res) {
void __iomem *csr = devm_ioremap_resources();
if (IS_ERR(csr)) {
ret = ERR_PTR(csr);
dev_xxx();
goto err;
}
ctx->csr_mux = csr;
}Then you never end up in the situation where csr_mux contains an error pointer value - and is much more obvious that is the case.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net.