From: Dan Carpenter <dan.carpenter@oracle.com>
To: mihail.chindris@analog.com
Cc: linux-iio@vger.kernel.org
Subject: [bug report] drivers:iio:dac: Add AD3552R driver support
Date: Thu, 6 Jan 2022 13:35:53 +0300 [thread overview]
Message-ID: <20220106103553.GA26440@kili> (raw)
Hello Mihail Chindris,
The patch 8f2b54824b28: "drivers:iio:dac: Add AD3552R driver support"
from Dec 13, 2021, leads to the following Smatch static checker
warning:
drivers/iio/dac/ad3552r.c:688 ad3552r_reset()
warn: impossible condition '(val < 0) => (0-u16max < 0)'
drivers/iio/dac/ad3552r.c:699 ad3552r_reset()
warn: impossible condition '(val < 0) => (0-u16max < 0)'
drivers/iio/dac/ad3552r.c
655 static int ad3552r_reset(struct ad3552r_desc *dac)
656 {
657 struct reg_addr_pool addr;
658 int ret;
659 u16 val;
^^^^^^^
660
661 dac->gpio_reset = devm_gpiod_get_optional(&dac->spi->dev, "reset",
662 GPIOD_OUT_LOW);
663 if (IS_ERR(dac->gpio_reset))
664 return dev_err_probe(&dac->spi->dev, PTR_ERR(dac->gpio_reset),
665 "Error while getting gpio reset");
666
667 if (dac->gpio_reset) {
668 /* Perform hardware reset */
669 usleep_range(10, 20);
670 gpiod_set_value_cansleep(dac->gpio_reset, 1);
671 } else {
672 /* Perform software reset if no GPIO provided */
673 ret = ad3552r_update_reg_field(dac,
674 AD3552R_REG_ADDR_INTERFACE_CONFIG_A,
675 AD3552R_MASK_SOFTWARE_RESET,
676 AD3552R_MASK_SOFTWARE_RESET);
677 if (ret < 0)
678 return ret;
679
680 }
681
682 addr.dac = dac;
683 addr.addr = AD3552R_REG_ADDR_INTERFACE_CONFIG_B;
684 ret = readx_poll_timeout(ad3552r_read_reg_wrapper, &addr, val,
685 val == AD3552R_DEFAULT_CONFIG_B_VALUE ||
686 val < 0,
^^^^^^^
Unsigned can't be < 0.
687 5000, 50000);
--> 688 if (val < 0)
^^^^^^^
689 ret = val;
690 if (ret) {
691 dev_err(&dac->spi->dev, "Error while resetting");
692 return ret;
693 }
694
695 ret = readx_poll_timeout(ad3552r_read_reg_wrapper, &addr, val,
696 !(val & AD3552R_MASK_INTERFACE_NOT_READY) ||
697 val < 0,
^^^^^^^
698 5000, 50000);
699 if (val < 0)
^^^^^^^
700 ret = val;
701 if (ret) {
702 dev_err(&dac->spi->dev, "Error while resetting");
703 return ret;
704 }
705
706 return ad3552r_update_reg_field(dac,
707 addr_mask_map[AD3552R_ADDR_ASCENSION][0],
708 addr_mask_map[AD3552R_ADDR_ASCENSION][1],
709 val);
710 }
regards,
dan carpenter
next reply other threads:[~2022-01-06 10:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-06 10:35 Dan Carpenter [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-04-01 10:06 [bug report] drivers:iio:dac: Add AD3552R driver support Dan Carpenter
2022-04-01 12:07 ` Sa, Nuno
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=20220106103553.GA26440@kili \
--to=dan.carpenter@oracle.com \
--cc=linux-iio@vger.kernel.org \
--cc=mihail.chindris@analog.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.