mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alfredo Cruz <alfredo.carlon@gmail.com>
To: linux@armlinux.org.uk, arnd@arndb.de,
	u.kleine-koenig@pengutronix.de, shawnguo@kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: Alfredo Cruz <alfredo.carlon@gmail.com>
Subject: [PATCH] ARM: sa1111: fix put_device() before device_add() in error path
Date: Wed, 21 Feb 2024 22:38:37 +0100	[thread overview]
Message-ID: <20240221213837.27605-1-alfredo.carlon@gmail.com> (raw)

When request_resource() fails, a jump is made to err_resource label which
calls put_device() on &dev->res without adding it first.
Kept the err_resource label and moved put_device() to err_add label.

Signed-off-by: Alfredo Cruz <alfredo.carlon@gmail.com>
---
 arch/arm/common/sa1111.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index 1fbd7363cf11..76bf15da5115 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -779,8 +779,8 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent,
 
  err_add:
 	release_resource(&dev->res);
- err_resource:
 	put_device(&dev->dev);
+ err_resource:
  err_alloc:
 	return ret;
 }
-- 
2.43.2


             reply	other threads:[~2024-02-21 21:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21 21:38 Alfredo Cruz [this message]
2024-02-21 21:57 ` Russell King (Oracle)

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=20240221213837.27605-1-alfredo.carlon@gmail.com \
    --to=alfredo.carlon@gmail.com \
    --cc=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=shawnguo@kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®