[PATCH -next] pcd: capture error codes on pcd_probe() and pf_probe()
From: Yang Li
Date: Wed Sep 29 2021 - 02:40:40 EST
No error code were being captured when pcd_probe() and
pf_probe() fail, capture them by assigning them to ret.
Clean up smatch warning:
drivers/block/paride/pcd.c:939 pcd_init_unit() warn: missing error code
'ret'
drivers/block/paride/pf.c:963 pf_init_unit() warn: missing error code
'ret'
Reported-by: Abaci Robot <abaci@xxxxxxxxxxxxxxxxx>
Signed-off-by: Yang Li <yang.lee@xxxxxxxxxxxxxxxxx>
---
drivers/block/paride/pcd.c | 3 ++-
drivers/block/paride/pf.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 4cc0d14..9ae8859 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -935,7 +935,8 @@ static int pcd_init_unit(struct pcd_unit *cd, bool autoprobe, int port,
if (!pi_init(cd->pi, autoprobe, port, mode, unit, protocol, delay,
pcd_buffer, PI_PCD, verbose, cd->name))
goto out_free_disk;
- if (pcd_probe(cd, ms))
+ ret = pcd_probe(cd, ms);
+ if (ret)
goto out_pi_release;
cd->present = 1;
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index 380d80e..7b9acfc 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -959,7 +959,8 @@ static int __init pf_init_unit(struct pf_unit *pf, bool autoprobe, int port,
if (!pi_init(pf->pi, autoprobe, port, mode, unit, protocol, delay,
pf_scratch, PI_PF, verbose, pf->name))
goto out_free_disk;
- if (pf_probe(pf))
+ ret = pf_probe(pf);
+ if (ret)
goto out_pi_release;
ret = add_disk(disk);
--
1.8.3.1