]> git.baikalelectronics.ru Git - kernel.git/commit
i3c: master: dw: check return of dw_i3c_master_get_free_pos()
authorTom Rix <trix@redhat.com>
Sat, 8 Jan 2022 15:09:48 +0000 (07:09 -0800)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 13 Jan 2022 01:05:50 +0000 (02:05 +0100)
commit28704491f02d5b1f25c5c0ad5d26e28e1b0017d6
treea5ed22167ccda1202bbbe7c7e3eacdc94ac7b611
parent1e0b9ed6e2f23fb8d9617fe2c4778d47213924c0
i3c: master: dw: check return of dw_i3c_master_get_free_pos()

Clang static analysis reports this problem
dw-i3c-master.c:799:9: warning: The result of the left shift is
  undefined because the left operand is negative
                      COMMAND_PORT_DEV_INDEX(pos) |
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~

pos can be negative because dw_i3c_master_get_free_pos() can return an
error.  So check for an error.

Fixes: f3f0baf4b710 ("i3c: master: Add driver for Synopsys DesignWare IP")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220108150948.3988790-1-trix@redhat.com
drivers/i3c/master/dw-i3c-master.c