]> www.infradead.org Git - users/hch/misc.git/commitdiff
usb: gadget: tegra-xudc: Remove redundant ternary operators
authorLiao Yuanhong <liaoyuanhong@vivo.com>
Tue, 2 Sep 2025 13:26:08 +0000 (21:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Sep 2025 13:32:32 +0000 (15:32 +0200)
For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Link: https://lore.kernel.org/r/20250902132613.84876-1-liaoyuanhong@vivo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/udc/tegra-xudc.c

index 1d3085cc9d2228b1577476c9d3ce06d1ab5865c9..0c38fc37b6e66cbfd120f66a4bfe4bda2ef9ac74 100644 (file)
@@ -812,8 +812,7 @@ static void tegra_xudc_update_data_role(struct tegra_xudc *xudc,
                return;
        }
 
-       xudc->device_mode = (usbphy->last_event == USB_EVENT_VBUS) ? true :
-                                                                    false;
+       xudc->device_mode = usbphy->last_event == USB_EVENT_VBUS;
 
        phy_index = tegra_xudc_get_phy_index(xudc, usbphy);
        dev_dbg(xudc->dev, "%s(): current phy index is %d\n", __func__,