linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Stuart Yoder <stuyoder@gmail.com>,
	Laurentiu Tudor <laurentiu.tudor@nxp.com>
Cc: linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: [PATCH 1/2] bus: fsl-mc:  Drop if block with always false condition
Date: Sat,  4 Nov 2023 00:00:02 +0100	[thread overview]
Message-ID: <20231103230001.3652259-3-u.kleine-koenig@pengutronix.de> (raw)

The mc that belongs to a pdev is always a root dprc. In
fsl_mc_bus_probe() the mc device gets assigned the platform device as
parent. As dev_is_fsl_mc() is false for a platform device,
fsl_mc_get_root_dprc() will always be true and so the if body is never
run and it can be dropped.

The motivation for this change is to get rid of an error path in
.remove() that is broken (because only a part of the necessary cleanup
is done resulting in leaks and/or use-after-frees and the driver core
ignores the return value of .remove().)

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/bus/fsl-mc/fsl-mc-bus.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index 2f6d5002e43d..75a8d365ffd4 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -1172,9 +1172,6 @@ static int fsl_mc_bus_remove(struct platform_device *pdev)
 	struct fsl_mc *mc = platform_get_drvdata(pdev);
 	struct fsl_mc_io *mc_io;
 
-	if (!fsl_mc_is_root_dprc(&mc->root_mc_bus_dev->dev))
-		return -EINVAL;
-
 	mc_io = mc->root_mc_bus_dev->mc_io;
 	fsl_mc_device_remove(mc->root_mc_bus_dev);
 	fsl_destroy_mc_io(mc_io);

base-commit: e27090b1413ff236ca1aec26d6b022149115de2c
-- 
2.42.0


             reply	other threads:[~2023-11-03 23:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03 23:00 Uwe Kleine-König [this message]
2023-11-03 23:00 ` [PATCH 2/2] bus: fsl-mc: Convert to platform remove callback returning void Uwe Kleine-König
2023-11-05 14:31 ` [PATCH 1/2] bus: fsl-mc: Drop if block with always false condition Uwe Kleine-König
2023-11-28 17:03   ` Uwe Kleine-König
2023-12-04 17:10     ` Uwe Kleine-König

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=20231103230001.3652259-3-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=laurentiu.tudor@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stuyoder@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).