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] [day] [month] [year] [list]
Message-ID: <20170818124203.GA4556@ulmo>
Date:   Fri, 18 Aug 2017 14:42:03 +0200
From:   Thierry Reding <thierry.reding@...il.com>
To:     Chunfeng Yun <chunfeng.yun@...iatek.com>
Cc:     Kishon Vijay Abraham I <kishon@...com>,
        Heiko Stuebner <heiko@...ech.de>,
        Kukjin Kim <kgene@...nel.org>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        Kamil Debski <kamil@...as.org>,
        Sylwester Nawrocki <s.nawrocki@...sung.com>,
        Jonathan Hunter <jonathanh@...dia.com>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
        Lee Jones <lee.jones@...aro.org>,
        Vivek Gautam <vivek.gautam@...eaurora.org>,
        Axel Lin <axel.lin@...ics.com>,
        Baoyou Xie <baoyou.xie@...aro.org>,
        Arnd Bergmann <arnd@...db.de>, Sekhar Nori <nsekhar@...com>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        Jaehoon Chung <jh80.chung@...sung.com>,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-rockchip@...ts.infradead.org,
        linux-samsung-soc@...r.kernel.org, linux-tegra@...r.kernel.org,
        linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH 4/4] phy: tegra: use of_device_get_match_data()

On Wed, Aug 09, 2017 at 05:18:00PM +0800, Chunfeng Yun wrote:
> reduce the boilerplate code to get the specific data
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@...iatek.com>
> ---
>  drivers/phy/tegra/xusb.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

You're not reducing by much here. =)

> diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
> index 3cbcb25..25cdfb1 100644
> --- a/drivers/phy/tegra/xusb.c
> +++ b/drivers/phy/tegra/xusb.c
> @@ -848,7 +848,6 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev)
>  	struct device_node *np = of_node_get(pdev->dev.of_node);
>  	const struct tegra_xusb_padctl_soc *soc;
>  	struct tegra_xusb_padctl *padctl;
> -	const struct of_device_id *match;
>  	struct resource *res;
>  	int err;
>  
> @@ -861,8 +860,9 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev)
>  
>  	of_node_put(np);
>  
> -	match = of_match_node(tegra_xusb_padctl_of_match, pdev->dev.of_node);
> -	soc = match->data;
> +	soc = of_device_get_match_data(&pdev->dev);
> +	if (!soc)
> +		return -EINVAL;

This is never going to happen. There will always be a match, otherwise
this function would never be called.

Also, if you omit these last two lines, then you actually do reduce the
boilerplate.

Thierry

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ