Skip to content

Commit 322b86e

Browse files
andy-shevbrgl
authored andcommitted
gpiolib: Use short form of ternary operator in gpiod_get_index()
Instead of repeating first argument for true branch, use short form of the ternary operator, i.e. ?:. While at it, fix a typo in the comment. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
1 parent 80c78fb commit 322b86e

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

drivers/gpio/gpiolib.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3931,19 +3931,18 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
39313931
* If a connection label was passed use that, else attempt to use
39323932
* the device name as label
39333933
*/
3934-
ret = gpiod_request(desc, con_id ? con_id : devname);
3934+
ret = gpiod_request(desc, con_id ?: devname);
39353935
if (ret) {
39363936
if (ret == -EBUSY && flags & GPIOD_FLAGS_BIT_NONEXCLUSIVE) {
39373937
/*
39383938
* This happens when there are several consumers for
39393939
* the same GPIO line: we just return here without
3940-
* further initialization. It is a bit if a hack.
3940+
* further initialization. It is a bit of a hack.
39413941
* This is necessary to support fixed regulators.
39423942
*
39433943
* FIXME: Make this more sane and safe.
39443944
*/
3945-
dev_info(dev, "nonexclusive access to GPIO for %s\n",
3946-
con_id ? con_id : devname);
3945+
dev_info(dev, "nonexclusive access to GPIO for %s\n", con_id ?: devname);
39473946
return desc;
39483947
} else {
39493948
return ERR_PTR(ret);

0 commit comments

Comments
 (0)