summaryrefslogtreecommitdiffstats
path: root/drivers/phy/broadcom
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2020-12-16 15:33:04 +0100
committerVinod Koul <vkoul@kernel.org>2021-01-13 12:58:58 +0100
commitd14f4cce9340a6586512a0eb6bc680dedeaaef14 (patch)
treef22186f645fac25d8e408828b92a8d315334ef2f /drivers/phy/broadcom
parentLinux 5.11-rc1 (diff)
downloadlinux-d14f4cce9340a6586512a0eb6bc680dedeaaef14.tar.xz
linux-d14f4cce9340a6586512a0eb6bc680dedeaaef14.zip
phy: phy-brcm-usb: improve getting OF matching data
1. Use of_device_get_match_data() helper to simplify the code 2. Check for NULL as a good practice Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20201216143305.12179-1-zajec5@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/phy/broadcom')
-rw-r--r--drivers/phy/broadcom/phy-brcm-usb.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/phy/broadcom/phy-brcm-usb.c b/drivers/phy/broadcom/phy-brcm-usb.c
index 99fbc7e4138b..65fe592dd7f0 100644
--- a/drivers/phy/broadcom/phy-brcm-usb.c
+++ b/drivers/phy/broadcom/phy-brcm-usb.c
@@ -11,6 +11,7 @@
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/of_device.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
@@ -427,7 +428,6 @@ static int brcm_usb_phy_probe(struct platform_device *pdev)
struct device_node *dn = pdev->dev.of_node;
int err;
const char *mode;
- const struct of_device_id *match;
void (*dvr_init)(struct brcm_usb_init_params *params);
const struct match_chip_info *info;
struct regmap *rmap;
@@ -441,8 +441,9 @@ static int brcm_usb_phy_probe(struct platform_device *pdev)
priv->ini.family_id = brcmstb_get_family_id();
priv->ini.product_id = brcmstb_get_product_id();
- match = of_match_node(brcm_usb_dt_ids, dev->of_node);
- info = match->data;
+ info = of_device_get_match_data(&pdev->dev);
+ if (!info)
+ return -ENOENT;
dvr_init = info->init_func;
(*dvr_init)(&priv->ini);