lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151118044414.GC4228@shlinux2>
Date:	Wed, 18 Nov 2015 12:44:15 +0800
From:	Peter Chen <peter.chen@...escale.com>
To:	Saurabh Sengar <saurabh.truth@...il.com>
CC:	Måns Rullgård <mans@...sr.com>,
	Greg KH <gregkh@...uxfoundation.org>,
	<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3] usb: chipidea: removing of_find_property

On Wed, Nov 18, 2015 at 09:30:39AM +0530, Saurabh Sengar wrote:
> Hi Peter,
> 
> Yes itc_setting is still optional, in case dts does not pass this
> property, return type will be -EINVAL and there would be no problem.
> The function will break only if there is 'No data'(-ENODATA) or
> 'overflow'(-ENODATA) error for this property.

If there is an error, the variable pass to of_property_read_u32 will
not be changed.

Peter
> In case this is not OK, I will send a another patch(v4) as you have suggested.
> 
> Regards,
> Saurabh
> 
> On 18 November 2015 at 09:08, Peter Chen <peter.chen@...escale.com> wrote:
> > On Tue, Nov 17, 2015 at 05:22:26PM +0530, Saurabh Sengar wrote:
> >> 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@...il.com>
> >> ---
> >> v2 : removed pval variable
> >> v3 : removed unnecessary if condition
> >>  drivers/usb/chipidea/core.c | 59 +++++++++++++++++++--------------------------
> >>  1 file changed, 25 insertions(+), 34 deletions(-)
> >>
> >> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> >> index 965d0e2..960a925 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",
> >> +     of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
> >>                                    &platdata->phy_clkgate_delay_us);
> >>
> >>       platdata->itc_setting = 1;
> >> -     if (of_find_property(dev->of_node, "itc-setting", NULL)) {
> >> -             ret = of_property_read_u32(dev->of_node, "itc-setting",
> >> -                     &platdata->itc_setting);
> >> -             if (ret) {
> >> -                     dev_err(dev,
> >> -                             "failed to get itc-setting\n");
> >> -                     return ret;
> >> -             }
> >> +
> >> +     ret = of_property_read_u32(dev->of_node, "itc-setting",
> >> +                                     &platdata->itc_setting);
> >> +     if (ret && ret != -EINVAL) {
> >> +             dev_err(dev, "failed to get itc-setting\n");
> >> +             return ret;
> >>       }
> >
> > For this one, you may not need to check return value, since
> > platdata->itc_setting is optional, and doesn't need to set
> > any flags if platdata->itc_setting is valid.
> >
> > Other changes are ok for me.
> >
> > Peter
> >
> >>
> >> -     if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) {
> >> -             ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
> >> -                     &platdata->ahb_burst_config);
> >> -             if (ret) {
> >> -                     dev_err(dev,
> >> -                             "failed to get ahb-burst-config\n");
> >> -                     return ret;
> >> -             }
> >> +     ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
> >> +                             &platdata->ahb_burst_config);
> >> +     if (!ret) {
> >>               platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST;
> >> +     } else if (ret != -EINVAL) {
> >> +             dev_err(dev, "failed to get ahb-burst-config\n");
> >> +             return ret;
> >>       }
> >>
> >> -     if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) {
> >> -             ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
> >> -                     &platdata->tx_burst_size);
> >> -             if (ret) {
> >> -                     dev_err(dev,
> >> -                             "failed to get tx-burst-size-dword\n");
> >> -                     return ret;
> >> -             }
> >> +     ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
> >> +                             &platdata->tx_burst_size);
> >> +     if (!ret) {
> >>               platdata->flags |= CI_HDRC_OVERRIDE_TX_BURST;
> >> +     } else if (ret != -EINVAL) {
> >> +             dev_err(dev, "failed to get tx-burst-size-dword\n");
> >> +             return ret;
> >>       }
> >>
> >> -     if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) {
> >> -             ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
> >> -                     &platdata->rx_burst_size);
> >> -             if (ret) {
> >> -                     dev_err(dev,
> >> -                             "failed to get rx-burst-size-dword\n");
> >> -                     return ret;
> >> -             }
> >> +     ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
> >> +                             &platdata->rx_burst_size);
> >> +     if (!ret) {
> >>               platdata->flags |= CI_HDRC_OVERRIDE_RX_BURST;
> >> +     } else if (ret != -EINVAL) {
> >> +             dev_err(dev, "failed to get rx-burst-size-dword\n");
> >> +             return ret;
> >>       }
> >>
> >>       ext_id = ERR_PTR(-ENODEV);
> >> --
> >> 1.9.1
> >>
> >
> > --
> >
> > Best Regards,
> > Peter Chen

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ