[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241202163451.1442566-5-mschmidt@redhat.com>
Date: Mon, 2 Dec 2024 17:34:49 +0100
From: Michal Schmidt <mschmidt@...hat.com>
To: Rodolfo Giometti <giometti@...eenne.com>
Cc: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
"Dr. David Alan Gilbert" <linux@...blig.org>,
Ma Ke <make24@...as.ac.cn>,
Andrew Morton <akpm@...ux-foundation.org>,
George Spelvin <linux@...izon.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH 4/6] pps: print error in both cdev and dev error paths in pps_register_cdev()
For pps, a device_create() failure is just as severe as a cdev_add()
failure. Print the error message in both cases.
Signed-off-by: Michal Schmidt <mschmidt@...hat.com>
---
drivers/pps/pps.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
index 92be7815a621..f90ee483d343 100644
--- a/drivers/pps/pps.c
+++ b/drivers/pps/pps.c
@@ -357,11 +357,9 @@ int pps_register_cdev(struct pps_device *pps)
pps->cdev.owner = pps->info.owner;
err = cdev_add(&pps->cdev, devt, 1);
- if (err) {
- pr_err("%s: failed to add char device %d:%d\n",
- pps->info.name, MAJOR(pps_devt), pps->id);
+ if (err)
goto free_idr;
- }
+
pps->dev = device_create(pps_class, pps->info.dev, devt, pps,
"pps%d", pps->id);
if (IS_ERR(pps->dev)) {
@@ -387,6 +385,8 @@ int pps_register_cdev(struct pps_device *pps)
free_idr:
scoped_guard(mutex, &pps_idr_lock)
idr_remove(&pps_idr, pps->id);
+ pr_err("%s: failed to add char device %d:%d\n",
+ pps->info.name, MAJOR(pps_devt), pps->id);
return err;
}
--
2.47.0
Powered by blists - more mailing lists