mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-18 10:56:14 +00:00
ata: pata_parport: Fix ida_alloc return value error check
pi->dev.id is unsigned so error checking of ida_alloc return value does not work. Fix it. Signed-off-by: Ondrej Zary <linux@zary.sk> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
This commit is contained in:
parent
72f2b0b218
commit
8844f0aa8d
@ -424,6 +424,7 @@ static struct pi_adapter *pi_init_one(struct parport *parport,
|
|||||||
struct ata_host *host;
|
struct ata_host *host;
|
||||||
struct pi_adapter *pi;
|
struct pi_adapter *pi;
|
||||||
struct pi_device_match match = { .parport = parport, .proto = pr };
|
struct pi_device_match match = { .parport = parport, .proto = pr };
|
||||||
|
int id;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Abort if there's a device already registered on the same parport
|
* Abort if there's a device already registered on the same parport
|
||||||
@ -441,9 +442,10 @@ static struct pi_adapter *pi_init_one(struct parport *parport,
|
|||||||
pi->dev.bus = &pata_parport_bus_type;
|
pi->dev.bus = &pata_parport_bus_type;
|
||||||
pi->dev.driver = &pr->driver;
|
pi->dev.driver = &pr->driver;
|
||||||
pi->dev.release = pata_parport_dev_release;
|
pi->dev.release = pata_parport_dev_release;
|
||||||
pi->dev.id = ida_alloc(&pata_parport_bus_dev_ids, GFP_KERNEL);
|
id = ida_alloc(&pata_parport_bus_dev_ids, GFP_KERNEL);
|
||||||
if (pi->dev.id < 0)
|
if (id < 0)
|
||||||
return NULL; /* pata_parport_dev_release will do kfree(pi) */
|
return NULL; /* pata_parport_dev_release will do kfree(pi) */
|
||||||
|
pi->dev.id = id;
|
||||||
dev_set_name(&pi->dev, "pata_parport.%u", pi->dev.id);
|
dev_set_name(&pi->dev, "pata_parport.%u", pi->dev.id);
|
||||||
if (device_register(&pi->dev)) {
|
if (device_register(&pi->dev)) {
|
||||||
put_device(&pi->dev);
|
put_device(&pi->dev);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user