Re: [PATCH 03/10] phy: renesas: rcar-gen3-usb2: Check dr_mode when not using OTG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/07/2019 02:45 PM, Chris Brandt wrote:

>>> --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
>>> +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
>>> @@ -408,7 +408,12 @@ static int rcar_gen3_phy_usb2_init(struct phy *p)
>>>  		if (rcar_gen3_needs_init_otg(channel))
>>>  			rcar_gen3_init_otg(channel);
>>>  		rphy->otg_initialized = true;
>>> -	}
>>> +	} else
>>
>>    Wait, don't we neeed {} here?
>>
>>> +		/* Not OTG, so dr_mode should be set in PHY node */
>>> +		if (usb_get_dr_mode(channel->dev) == USB_DR_MODE_PERIPHERAL)
>>> +			writel(0x80000000, usb2_base + USB2_COMMCTRL);
>>> +		else
>>> +			writel(0x00000000, usb2_base + USB2_COMMCTRL);
> 
> Technically there is only 1 statement after the else (the 'if' which 
> will also include the 'else') statement. The coding rules say not to use
> { } if there is only 1 statement.

   Don't you remember another rule: use {} in all branches if at least 
one branch uses {}?

> Chris

MBR, Sergei





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux