lkml.org 
[lkml]   [2015]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2] usb: chipidea: removing of_find_property
Date
Saurabh Sengar <saurabh.truth@gmail.com> writes:

> call to of_find_property() before of_property_read_u32() is unnecessary.
> of_property_read_u32() anyway calls to of_find_property() only.
>
> Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
> ---
> v2: removed pval variable
> drivers/usb/chipidea/core.c | 61 +++++++++++++++++++--------------------------
> 1 file changed, 26 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 965d0e2..916a20d 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -688,52 +688,43 @@ static int ci_get_platdata(struct device *dev,
> if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
> platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
>
> - if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL))
> - of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
> - &platdata->phy_clkgate_delay_us);
> + if (!of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
> + &platdata->phy_clkgate_delay_us))
>
> platdata->itc_setting = 1;

Drop that if(). Since we're ignoring of_property_read_u32() failing,
there is no need to test its return value, and code above incorrectly
makes the next statement conditional.

--
Måns Rullgård
mans@mansr.com


\
 
 \ /
  Last update: 2015-11-17 13:01    [W:0.046 / U:1.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site