diff mbox series

[v2] scsi: fdomain: Fix error return code in fdomain_probe()

Message ID 20210715032625.1395495-1-liwei391@huawei.com (mailing list archive)
State Accepted
Headers show
Series [v2] scsi: fdomain: Fix error return code in fdomain_probe() | expand

Commit Message

Wei Li July 15, 2021, 3:26 a.m. UTC
When it fail to request_region, it just jump to 'fail_disable',
while the 'ret' is not updated. So assign the return code before
that.

Fixes: 8674a8aa2c39 ("scsi: fdomain: Add PCMCIA support")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Li <liwei391@huawei.com>
---
 drivers/scsi/pcmcia/fdomain_cs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Martin K. Petersen Aug. 10, 2021, 3:32 a.m. UTC | #1
Wei,

> When it fail to request_region, it just jump to 'fail_disable', while
> the 'ret' is not updated. So assign the return code before that.

Applied to 5.15/scsi-staging, thanks!
Martin K. Petersen Aug. 17, 2021, 3:17 a.m. UTC | #2
On Thu, 15 Jul 2021 11:26:25 +0800, Wei Li wrote:

> When it fail to request_region, it just jump to 'fail_disable',
> while the 'ret' is not updated. So assign the return code before
> that.
> 
> 
> 
> 
> [...]

Applied to 5.15/scsi-queue, thanks!

[1/1] scsi: fdomain: Fix error return code in fdomain_probe()
      https://git.kernel.org/mkp/scsi/c/632c4ae6da1d
diff mbox series

Patch

diff --git a/drivers/scsi/pcmcia/fdomain_cs.c b/drivers/scsi/pcmcia/fdomain_cs.c
index e42acf314d06..33df6a9ba9b5 100644
--- a/drivers/scsi/pcmcia/fdomain_cs.c
+++ b/drivers/scsi/pcmcia/fdomain_cs.c
@@ -45,8 +45,10 @@  static int fdomain_probe(struct pcmcia_device *link)
 		goto fail_disable;
 
 	if (!request_region(link->resource[0]->start, FDOMAIN_REGION_SIZE,
-			    "fdomain_cs"))
+			    "fdomain_cs")) {
+		ret = -EBUSY;
 		goto fail_disable;
+	}
 
 	sh = fdomain_create(link->resource[0]->start, link->irq, 7, &link->dev);
 	if (!sh) {