Linux-m68k Archive on lore.kernel.org
 help / color / Atom feed
From: Qinglang Miao <miaoqinglang@huawei.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: <linux-m68k@lists.linux-m68k.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH -next] m68k/amiga: missing platform_device_unregister() on error in amiga_init_devices()
Date: Tue, 28 Jul 2020 10:27:46 +0800
Message-ID: <20200728022746.87612-1-miaoqinglang@huawei.com> (raw)

Add the missing platform_device_unregister() before return
from amiga_init_devices() in the error handling case.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
 arch/m68k/amiga/platform.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/m68k/amiga/platform.c b/arch/m68k/amiga/platform.c
index d34029d7b..afa2782c6 100644
--- a/arch/m68k/amiga/platform.c
+++ b/arch/m68k/amiga/platform.c
@@ -188,8 +188,10 @@ static int __init amiga_init_devices(void)
 			return PTR_ERR(pdev);
 		error = platform_device_add_data(pdev, &a1200_ide_pdata,
 						 sizeof(a1200_ide_pdata));
-		if (error)
+		if (error) {
+			platform_device_unregister(pdev);
 			return error;
+		}
 	}
 
 	if (AMIGAHW_PRESENT(A4000_IDE)) {
@@ -199,8 +201,10 @@ static int __init amiga_init_devices(void)
 			return PTR_ERR(pdev);
 		error = platform_device_add_data(pdev, &a4000_ide_pdata,
 						 sizeof(a4000_ide_pdata));
-		if (error)
+		if (error) {
+			platform_device_unregister(pdev);
 			return error;
+		}
 	}
 
 
-- 
2.25.1


                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200728022746.87612-1-miaoqinglang@huawei.com \
    --to=miaoqinglang@huawei.com \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-m68k Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-m68k/0 linux-m68k/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-m68k linux-m68k/ https://lore.kernel.org/linux-m68k \
		linux-m68k@vger.kernel.org linux-m68k@lists.linux-m68k.org
	public-inbox-index linux-m68k

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-m68k


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git