From: Dan Carpenter <error27@gmail.com>
To: linux@zary.sk
Cc: linux-ide@vger.kernel.org
Subject: [bug report] ata: pata_parport: add driver (PARIDE replacement)
Date: Thu, 2 Feb 2023 15:46:33 +0300 [thread overview]
Message-ID: <Y9uwqRothHhaOeDO@kili> (raw)
Hello Ondrej Zary,
The patch 246a1c4c6b7f: "ata: pata_parport: add driver (PARIDE
replacement)" from Jan 23, 2023, leads to the following Smatch static
checker warning:
drivers/ata/pata_parport/pata_parport.c:445 pi_init_one()
warn: unsigned 'pi->dev.id' is never less than zero.
drivers/ata/pata_parport/pata_parport.c
418 static struct pi_adapter *pi_init_one(struct parport *parport,
419 struct pi_protocol *pr, int mode, int unit, int delay)
420 {
421 struct pardev_cb par_cb = { };
422 char scratch[512];
423 const struct ata_port_info *ppi[] = { &pata_parport_port_info };
424 struct ata_host *host;
425 struct pi_adapter *pi;
426 struct pi_device_match match = { .parport = parport, .proto = pr };
427
428 /*
429 * Abort if there's a device already registered on the same parport
430 * using the same protocol.
431 */
432 if (bus_for_each_dev(&pata_parport_bus_type, NULL, &match, pi_find_dev))
433 return NULL;
434
435 pi = kzalloc(sizeof(struct pi_adapter), GFP_KERNEL);
436 if (!pi)
437 return NULL;
438
439 /* set up pi->dev before pi_probe_unit() so it can use dev_printk() */
440 pi->dev.parent = &pata_parport_bus;
441 pi->dev.bus = &pata_parport_bus_type;
442 pi->dev.driver = &pr->driver;
443 pi->dev.release = pata_parport_dev_release;
444 pi->dev.id = ida_alloc(&pata_parport_bus_dev_ids, GFP_KERNEL);
--> 445 if (pi->dev.id < 0)
^^^^^^^^^^^^^^
pi->dev.id is a u32.
446 return NULL; /* pata_parport_dev_release will do kfree(pi) */
447 dev_set_name(&pi->dev, "pata_parport.%u", pi->dev.id);
448 if (device_register(&pi->dev)) {
449 put_device(&pi->dev);
450 goto out_ida_free;
451 }
regards,
dan carpenter
next reply other threads:[~2023-02-02 12:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-02 12:46 Dan Carpenter [this message]
2023-02-04 20:55 ` [PATCH] pata_parport: Fix ida_alloc return value error check Ondrej Zary
2023-02-05 19:13 ` Sergey Shtylyov
2023-02-07 0:02 ` Damien Le Moal
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=Y9uwqRothHhaOeDO@kili \
--to=error27@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux@zary.sk \
/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