summaryrefslogtreecommitdiffstats
path: root/drivers/block/paride
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-10-01 14:26:54 +0200
committerJens Axboe <axboe@kernel.dk>2021-10-18 22:42:16 +0200
commitcfc03eabda8224c681087a4c6c51d1cc595ebfaf (patch)
treed9bdb194a3d0919cb85a3e2d5e7b839ba5d9d54f /drivers/block/paride
parentpcd: fix error codes in pcd_init_unit() (diff)
downloadlinux-cfc03eabda8224c681087a4c6c51d1cc595ebfaf.tar.xz
linux-cfc03eabda8224c681087a4c6c51d1cc595ebfaf.zip
pf: fix error codes in pf_init_unit()
Return a negative error code instead of success on these error paths. Fixes: fb367e6baeb0 ("pf: cleanup initialization") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20211001122654.GB2283@kili Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/paride')
-rw-r--r--drivers/block/paride/pf.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index 380d80e507c7..bf8d0ef41a0a 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -651,9 +651,9 @@ static int pf_identify(struct pf_unit *pf)
return 0;
}
-/* returns 0, with id set if drive is detected
- -1, if drive detection failed
-*/
+/*
+ * returns 0, with id set if drive is detected, otherwise an error code.
+ */
static int pf_probe(struct pf_unit *pf)
{
if (pf->drive == -1) {
@@ -675,7 +675,7 @@ static int pf_probe(struct pf_unit *pf)
if (!pf_identify(pf))
return 0;
}
- return -1;
+ return -ENODEV;
}
/* The i/o request engine */
@@ -957,9 +957,12 @@ static int __init pf_init_unit(struct pf_unit *pf, bool autoprobe, int port,
snprintf(pf->name, PF_NAMELEN, "%s%d", name, disk->first_minor);
if (!pi_init(pf->pi, autoprobe, port, mode, unit, protocol, delay,
- pf_scratch, PI_PF, verbose, pf->name))
+ pf_scratch, PI_PF, verbose, pf->name)) {
+ ret = -ENODEV;
goto out_free_disk;
- if (pf_probe(pf))
+ }
+ ret = pf_probe(pf);
+ if (ret)
goto out_pi_release;
ret = add_disk(disk);