Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751993AbbKQLUW (ORCPT ); Tue, 17 Nov 2015 06:20:22 -0500 Received: from unicorn.mansr.com ([81.2.72.234]:43991 "EHLO unicorn.mansr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751103AbbKQLUV convert rfc822-to-8bit (ORCPT ); Tue, 17 Nov 2015 06:20:21 -0500 From: =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?= To: Saurabh Sengar Cc: Peter.Chen@freescale.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: chipidea: removing of_find_property References: <1447758475-10252-1-git-send-email-saurabh.truth@gmail.com> Date: Tue, 17 Nov 2015 11:20:11 +0000 In-Reply-To: <1447758475-10252-1-git-send-email-saurabh.truth@gmail.com> (Saurabh Sengar's message of "Tue, 17 Nov 2015 16:37:55 +0530") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1709 Lines: 44 Saurabh Sengar 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 > --- > drivers/usb/chipidea/core.c | 67 ++++++++++++++++++++++----------------------- > 1 file changed, 32 insertions(+), 35 deletions(-) > > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c > index 965d0e2..8a4c22c 100644 > --- a/drivers/usb/chipidea/core.c > +++ b/drivers/usb/chipidea/core.c > @@ -643,6 +643,7 @@ static int ci_get_platdata(struct device *dev, > struct extcon_dev *ext_vbus, *ext_id; > struct ci_hdrc_cable *cable; > int ret; > + u32 pval; > > if (!platdata->phy_mode) > platdata->phy_mode = of_usb_get_phy_mode(dev->of_node); > @@ -688,52 +689,48 @@ 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", > + &pval)) > + platdata->phy_clkgate_delay_us = pval; You don't need to use the pval temporary as of_property_read_u32 only modifies the destination on success. -- M?ns Rullg?rd mans@mansr.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/