Re: [PATCH 1/2] ata: pata_parport: pin the protocol module before device_register()
From: Niklas Cassel <cassel@kernel.org>
Date: 2026-09-04 16:29:55
Also in:
sashiko-reviews
On Wed, Sep 02, 2026 at 12:06:08PM +0000, sashiko-bot@kernel.org wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Unused label `out_unreg_dev` causes compiler warning. -- commit 99f7607699410f6446da6e37e3bed84251a51bd8 Author: Pei Xiao [off-list ref] ata: pata_parport: pin the protocol module before device_register() Take the module reference before registering the device to prevent a race condition where the device is visible but the protocol module is not yet pinned. Also ensure the reference is dropped on the device_register() failure path.quoted
diff --git a/drivers/ata/pata_parport/pata_parport.c b/drivers/ata/pata_parport/pata_parport.c index cf81a6128f552..7462f9b1acc57 100644 --- a/drivers/ata/pata_parport/pata_parport.c +++ b/drivers/ata/pata_parport/pata_parport.c[ ... ]quoted
@@ -517,15 +525,12 @@ static struct pi_adapter *pi_init_one(struct parport *parport, pi->dev.id = id; dev_set_name(&pi->dev, "pata_parport.%u", pi->dev.id); if (device_register(&pi->dev)) { + module_put(pi->proto->owner); put_device(&pi->dev); /* pata_parport_dev_release will do ida_free(dev->id) and kfree(pi) */ return NULL; } - pi->proto = pr; - - if (!try_module_get(pi->proto->owner)) - goto out_unreg_dev;[Severity: Low] Does removing this goto leave the out_unreg_dev label unused at the bottom of pi_init_one()? If the label is no longer referenced, compiling the kernel will emit a -Wunused-label warning. This can cause build failures in configurations that enforce -Werror.
We don't want to introduce any new build warnings. W=1 builds are important too, even if not default. Kind regards, Niklas