@@ -2909,7 +2909,7 @@ static int sysc_init_soc(struct sysc *ddata)
}
match = soc_device_match(sysc_soc_feat_match);
- if (!match)
+ if (!match || IS_ERR(match))
return 0;
if (match->data)
@@ -439,6 +439,7 @@ static const unsigned int r8a7795es2_mod_nullify[] __initconst = {
static int __init r8a7795_cpg_mssr_init(struct device *dev)
{
+ const struct soc_device_attribute *match;
const struct rcar_gen3_cpg_pll_config *cpg_pll_config;
u32 cpg_mode;
int error;
@@ -453,7 +454,8 @@ static int __init r8a7795_cpg_mssr_init(struct device *dev)
return -EINVAL;
}
- if (soc_device_match(r8a7795es1)) {
+ match = soc_device_match(r8a7795es1);
+ if (!IS_ERR(match) && match) {
cpg_core_nullify_range(r8a7795_core_clks,
ARRAY_SIZE(r8a7795_core_clks),
R8A7795_CLK_S0D2, R8A7795_CLK_S0D12);
@@ -383,7 +383,7 @@ int __init rcar_gen2_cpg_init(const struct rcar_gen2_cpg_pll_config *config,
cpg_pll0_div = pll0_div;
cpg_mode = mode;
attr = soc_device_match(cpg_quirks_match);
- if (attr)
+ if (!IS_ERR(attr) && attr)
cpg_quirks = (uintptr_t)attr->data;
pr_debug("%s: mode = 0x%x quirks = 0x%x\n", __func__, mode, cpg_quirks);
@@ -499,7 +499,7 @@ int __init rcar_gen3_cpg_init(const struct rcar_gen3_cpg_pll_config *config,
cpg_clk_extalr = clk_extalr;
cpg_mode = mode;
attr = soc_device_match(cpg_quirks_match);
- if (attr)
+ if (!IS_ERR(attr) && attr)
cpg_quirks = (uintptr_t)attr->data;
pr_debug("%s: mode = 0x%x quirks = 0x%x\n", __func__, mode, cpg_quirks);
@@ -651,6 +651,7 @@ static int dpaa2_dpdmai_init_channels(struct dpaa2_qdma_engine *dpaa2_qdma)
static int dpaa2_qdma_probe(struct fsl_mc_device *dpdmai_dev)
{
+ const struct soc_device_attribute *match;
struct device *dev = &dpdmai_dev->dev;
struct dpaa2_qdma_engine *dpaa2_qdma;
struct dpaa2_qdma_priv *priv;
@@ -718,7 +719,11 @@ static int dpaa2_qdma_probe(struct fsl_mc_device *dpdmai_dev)
dpaa2_dpdmai_init_channels(dpaa2_qdma);
- if (soc_device_match(soc_fixup_tuning))
+ match = soc_device_match(soc_fixup_tuning);
+ if (IS_ERR(match))
+ return PTR_ERR(match);
+
+ if (match)
dpaa2_qdma->qdma_wrtype_fixup = true;
else
dpaa2_qdma->qdma_wrtype_fixup = false;
@@ -33,6 +33,9 @@ struct psil_endpoint_config *psil_get_ep_config(u32 thread_id)
const struct soc_device_attribute *soc;
soc = soc_device_match(k3_soc_devices);
+ if (IS_ERR(soc))
+ return PTR_ERR(soc);
+
if (soc) {
soc_ep_map = soc->data;
} else {
@@ -5188,7 +5188,7 @@ static int udma_probe(struct platform_device *pdev)
ud->match_data = match->data;
soc = soc_device_match(k3_soc_devices);
- if (!soc) {
+ if (!IS_ERR(soc) && !soc) {
dev_err(dev, "No compatible SoC found\n");
return -ENODEV;
}
@@ -1158,7 +1158,7 @@ static int nwl_dsi_probe(struct platform_device *pdev)
}
attr = soc_device_match(nwl_dsi_quirks_match);
- if (attr)
+ if (!IS_ERR(attr) && attr)
dsi->quirks = (uintptr_t)attr->data;
dsi->bridge.driver_private = dsi;
@@ -195,6 +195,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
{
struct platform_device *pdev = to_platform_device(dev);
const struct meson_drm_match_data *match;
+ const struct soc_device_attribute *attr;
struct meson_drm *priv;
struct drm_device *drm;
struct resource *res;
@@ -291,7 +292,8 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
/* Assign limits per soc revision/package */
for (i = 0 ; i < ARRAY_SIZE(meson_drm_soc_attrs) ; ++i) {
- if (soc_device_match(meson_drm_soc_attrs[i].attrs)) {
+ attr = soc_device_match(meson_drm_soc_attrs[i].attrs);
+ if (!IS_ERR(attr) && attr) {
priv->limits = &meson_drm_soc_attrs[i].limits;
break;
}
@@ -4741,7 +4741,7 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
* string, use SoC device matching.
*/
soc = soc_device_match(dispc_soc_devices);
- if (soc)
+ if (!IS_ERR(soc) && soc)
dispc->feat = soc->data;
else
dispc->feat = of_match_device(dispc_of_match, &pdev->dev)->data;
@@ -677,12 +677,14 @@ static const struct soc_device_attribute dpi_soc_devices[] = {
static int dpi_init_regulator(struct dpi_data *dpi)
{
struct regulator *vdds_dsi;
+ struct soc_device_attribute *soc;
/*
* The DPI uses the DSI VDDS on OMAP34xx, OMAP35xx, OMAP36xx, AM37xx and
* DM37xx only.
*/
- if (!soc_device_match(dpi_soc_devices))
+ soc = soc_device_match(dpi_soc_devices);
+ if (!IS_ERR(soc) && !soc)
return 0;
vdds_dsi = devm_regulator_get(&dpi->pdev->dev, "vdds_dsi");
@@ -4952,6 +4952,9 @@ static int dsi_probe(struct platform_device *pdev)
}
soc = soc_device_match(dsi_soc_devices);
+ if (IS_ERR(soc))
+ return PTR_ERR(soc);
+
if (soc)
dsi->data = soc->data;
else
@@ -1446,6 +1446,9 @@ static int dss_probe(struct platform_device *pdev)
* string, use SoC device matching.
*/
soc = soc_device_match(dss_soc_devices);
+ if (IS_ERR(soc))
+ return PTR_ERR(soc);
+
if (soc)
dss->feat = soc->data;
else
@@ -874,6 +874,9 @@ int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
const struct soc_device_attribute *soc;
soc = soc_device_match(hdmi4_soc_devices);
+ if (IS_ERR(soc))
+ return PTR_ERR(soc);
+
if (!soc)
return -ENODEV;
@@ -805,6 +805,7 @@ static const struct soc_device_attribute venc_soc_devices[] = {
static int venc_probe(struct platform_device *pdev)
{
+ const struct soc_device_attribute *match;
struct venc_device *venc;
struct resource *venc_mem;
int r;
@@ -818,7 +819,8 @@ static int venc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, venc);
/* The OMAP34xx, OMAP35xx and AM35xx VENC require the TV DAC clock. */
- if (soc_device_match(venc_soc_devices))
+ match = soc_device_match(venc_soc_devices);
+ if (!IS_ERR(match) && match)
venc->requires_tv_dac_clk = true;
venc->config = &venc_config_pal_trm;
@@ -576,6 +576,9 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
priv->dss->mgr_ops_priv = priv;
soc = soc_device_match(omapdrm_soc_devices);
+ if (IS_ERR(soc))
+ return PTR_ERR(soc);
+
priv->omaprev = soc ? (unsigned int)soc->data : 0;
priv->wq = alloc_ordered_workqueue("omapdrm", 0);
@@ -215,6 +215,7 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)
const struct drm_display_mode *mode = &rcrtc->crtc.state->adjusted_mode;
struct rcar_du_device *rcdu = rcrtc->dev;
unsigned long mode_clock = mode->clock * 1000;
+ const struct soc_device_attribute *match;
u32 dsmr;
u32 escr;
@@ -238,7 +239,8 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)
* no post-divider when a display PLL is present (as shown by
* the workaround breaking HDMI output on M3-W during testing).
*/
- if (soc_device_match(rcar_du_r8a7795_es1)) {
+ match = soc_device_match(rcar_du_r8a7795_es1);
+ if (!IS_ERR(match) && match) {
target *= 2;
div = 1;
}
@@ -912,7 +912,7 @@ static int rcar_lvds_probe(struct platform_device *pdev)
lvds->info = of_device_get_match_data(&pdev->dev);
attr = soc_device_match(lvds_quirk_matches);
- if (attr)
+ if (!IS_ERR(attr) && attr)
lvds->info = attr->data;
ret = rcar_lvds_parse_dt(lvds);
@@ -2643,8 +2643,10 @@ static void dispc_init_errata(struct dispc_device *dispc)
{ .family = "AM65X", .revision = "SR1.0" },
{ /* sentinel */ }
};
+ const struct soc_device_attribute *match;
- if (soc_device_match(am65x_sr10_soc_devices)) {
+ match = soc_device_match(am65x_sr10_soc_devices);
+ if (!IS_ERR(match) && match) {
dispc->errata.i2000 = true;
dev_info(dispc->dev, "WA for erratum i2000: YUV formats disabled\n");
}
@@ -757,17 +757,20 @@ static const char * const devices_allowlist[] = {
static bool ipmmu_device_is_allowed(struct device *dev)
{
+ const struct soc_device_attribute *match1, *match2;
unsigned int i;
/*
* R-Car Gen3 and RZ/G2 use the allow list to opt-in devices.
* For Other SoCs, this returns true anyway.
*/
- if (!soc_device_match(soc_needs_opt_in))
+ match1 = soc_device_match(soc_needs_opt_in);
+ if (!IS_ERR(match1) && !match1)
return true;
/* Check whether this SoC can use the IPMMU correctly or not */
- if (soc_device_match(soc_denylist))
+ match2 = soc_device_match(soc_denylist);
+ if (!IS_ERR(match2) && !match2)
return false;
/* Check whether this device can work with the IPMMU */
@@ -1413,7 +1413,7 @@ static int rcar_vin_probe(struct platform_device *pdev)
* uses different routing than r8a7795 ES2.0.
*/
attr = soc_device_match(r8a7795es1);
- if (attr)
+ if (!IS_ERR(attr) && attr)
vin->info = attr->data;
vin->base = devm_platform_ioremap_resource(pdev, 0);
@@ -1214,7 +1214,7 @@ static int rcsi2_probe(struct platform_device *pdev)
* share the same compatible string.
*/
attr = soc_device_match(r8a7795);
- if (attr)
+ if (!IS_ERR(attr) && attr)
priv->info = attr->data;
priv->dev = &pdev->dev;
@@ -240,6 +240,7 @@ static const struct soc_device_attribute vsp1_r8a7796[] = {
struct vsp1_uif *vsp1_uif_create(struct vsp1_device *vsp1, unsigned int index)
{
struct vsp1_uif *uif;
+ const struct soc_device_attribute *attr;
char name[6];
int ret;
@@ -247,7 +248,8 @@ struct vsp1_uif *vsp1_uif_create(struct vsp1_device *vsp1, unsigned int index)
if (!uif)
return ERR_PTR(-ENOMEM);
- if (soc_device_match(vsp1_r8a7796))
+ attr = soc_device_match(vsp1_r8a7796);
+ if (!IS_ERR(attr) && attr)
uif->m3w_quirk = true;
uif->entity.ops = &uif_entity_ops;
@@ -964,7 +964,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
of_data = of_device_get_match_data(&pdev->dev);
attr = soc_device_match(sdhi_quirks_match);
- if (attr)
+ if (!IS_ERR(attr) && attr)
quirks = attr->data;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -408,7 +408,7 @@ static int renesas_sdhi_internal_dmac_probe(struct platform_device *pdev)
const struct soc_device_attribute *soc = soc_device_match(soc_dma_quirks);
struct device *dev = &pdev->dev;
- if (soc)
+ if (!IS_ERR(soc) && soc)
global_flags |= (unsigned long)soc->data;
/* value is max of SD_SECCNT. Confirmed by HW engineers */
@@ -1336,6 +1336,7 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
struct sdhci_esdhc *esdhc;
struct device_node *np;
struct clk *clk;
+ const struct soc_device_attribute *match1, *match2, *match3;
u32 val;
u16 host_ver;
@@ -1346,17 +1347,20 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
esdhc->vendor_ver = (host_ver & SDHCI_VENDOR_VER_MASK) >>
SDHCI_VENDOR_VER_SHIFT;
esdhc->spec_ver = host_ver & SDHCI_SPEC_VER_MASK;
- if (soc_device_match(soc_incorrect_hostver))
+ match1 = soc_device_match(soc_incorrect_hostver);
+ if (!IS_ERR(match1) && match1)
esdhc->quirk_incorrect_hostver = true;
else
esdhc->quirk_incorrect_hostver = false;
- if (soc_device_match(soc_fixup_sdhc_clkdivs))
+ match2 = soc_device_match(soc_fixup_sdhc_clkdivs);
+ if (!IS_ERR(match2) && match2)
esdhc->quirk_limited_clk_division = true;
else
esdhc->quirk_limited_clk_division = false;
- if (soc_device_match(soc_unreliable_pulse_detection))
+ match3 = soc_device_match(soc_unreliable_pulse_detection);
+ if (!IS_ERR(match3) && match3)
esdhc->quirk_unreliable_pulse_detection = true;
else
esdhc->quirk_unreliable_pulse_detection = false;
@@ -1417,6 +1421,7 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
struct device_node *np;
struct sdhci_pltfm_host *pltfm_host;
struct sdhci_esdhc *esdhc;
+ const struct soc_device_attribute *match1, *match2;
int ret;
np = pdev->dev.of_node;
@@ -1443,12 +1448,18 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
pltfm_host = sdhci_priv(host);
esdhc = sdhci_pltfm_priv(pltfm_host);
- if (soc_device_match(soc_tuning_erratum_type1))
+ match1 = soc_device_match(soc_tuning_erratum_type1);
+ if (IS_ERR(match1))
+ return PTR_ERR(match1);
+ if (match1)
esdhc->quirk_tuning_erratum_type1 = true;
else
esdhc->quirk_tuning_erratum_type1 = false;
- if (soc_device_match(soc_tuning_erratum_type2))
+ match2 = soc_device_match(soc_tuning_erratum_type2);
+ if (IS_ERR(match2))
+ return PTR_ERR(match2);
+ if (match2)
esdhc->quirk_tuning_erratum_type2 = true;
else
esdhc->quirk_tuning_erratum_type2 = false;
@@ -1132,7 +1132,7 @@ static int sdhci_omap_probe(struct platform_device *pdev)
goto err_pltfm_free;
soc = soc_device_match(sdhci_omap_soc_devices);
- if (soc) {
+ if (!IS_ERR(soc) && soc) {
omap_host->version = "rev11";
if (!strcmp(dev_name(dev), "4809c000.mmc"))
mmc->f_max = 96000000;
@@ -787,7 +787,7 @@ static int sdhci_am654_probe(struct platform_device *pdev)
/* Update drvdata based on SoC revision */
soc = soc_device_match(sdhci_am654_devices);
- if (soc && soc->data)
+ if (!IS_ERR(soc) && soc && soc->data)
drvdata = soc->data;
host = sdhci_pltfm_init(pdev, drvdata->pdata, sizeof(*sdhci_am654));
@@ -1016,6 +1016,7 @@ static int ravb_phy_init(struct net_device *ndev)
struct ravb_private *priv = netdev_priv(ndev);
struct phy_device *phydev;
struct device_node *pn;
+ const struct soc_device_attribute *soc;
phy_interface_t iface;
int err;
@@ -1049,7 +1050,8 @@ static int ravb_phy_init(struct net_device *ndev)
/* This driver only support 10/100Mbit speeds on R-Car H3 ES1.0
* at this time.
*/
- if (soc_device_match(r8a7795es10)) {
+ soc = soc_device_match(r8a7795es10);
+ if (!IS_ERR(soc) && soc) {
err = phy_set_max_speed(phydev, SPEED_100);
if (err) {
netdev_err(ndev, "failed to limit PHY to 100Mbit/s\n");
@@ -2596,7 +2596,7 @@ static void am65_cpsw_nuss_apply_socinfo(struct am65_cpsw_common *common)
const struct soc_device_attribute *soc;
soc = soc_device_match(am65_cpsw_socinfo);
- if (soc && soc->data) {
+ if (!IS_ERR(soc) && soc && soc->data) {
const struct am65_cpsw_soc_pdata *socdata = soc->data;
/* disable quirks */
@@ -1579,7 +1579,7 @@ static int cpsw_probe(struct platform_device *pdev)
goto clean_dt_ret;
soc = soc_device_match(cpsw_soc_devices);
- if (soc)
+ if (!IS_ERR(soc) && soc)
cpsw->quirk_irq = true;
data = &cpsw->data;
@@ -1925,7 +1925,7 @@ static int cpsw_probe(struct platform_device *pdev)
goto clean_dt_ret;
soc = soc_device_match(cpsw_soc_devices);
- if (soc)
+ if (!IS_ERR(soc) && soc)
cpsw->quirk_irq = true;
cpsw->rx_packet_max = rx_packet_max;
@@ -348,6 +348,7 @@ static void omap_usb2_init_errata(struct omap_usb *phy)
{ .family = "AM65X", .revision = "SR1.0" },
{ /* sentinel */ }
};
+ const struct soc_device_attribute *soc;
/*
* Errata i2075: USB2PHY: USB2PHY Charger Detect is Enabled by
@@ -358,7 +359,8 @@ static void omap_usb2_init_errata(struct omap_usb *phy)
* Disabling the USB2_PHY Charger Detect function will put D+
* into the normal state.
*/
- if (soc_device_match(am65x_sr10_soc_devices))
+ soc = soc_device_match(am65x_sr10_soc_devices);
+ if (!IS_ERR(soc) && soc)
phy->flags |= OMAP_USB2_DISABLE_CHRG_DET;
}
@@ -1102,7 +1102,7 @@ static const void *sh_pfc_quirk_match(void)
};
match = soc_device_match(quirks);
- if (match)
+ if (!IS_ERR(match) && match)
return match->data ?: ERR_PTR(-ENODEV);
#endif /* CONFIG_PINCTRL_PFC_R8A77950 || CONFIG_PINCTRL_PFC_R8A77951 */
@@ -5999,8 +5999,11 @@ static const struct soc_device_attribute r8a7790_tdsel[] = {
static int r8a7790_pinmux_soc_init(struct sh_pfc *pfc)
{
+ const struct soc_device_attribute *match;
+
/* Initialize TDSEL on old revisions */
- if (soc_device_match(r8a7790_tdsel))
+ match = soc_device_match(r8a7790_tdsel);
+ if (!IS_ERR(match) && match)
sh_pfc_write(pfc, 0xe6060088, 0x00155554);
return 0;
@@ -5587,8 +5587,11 @@ static const struct soc_device_attribute r8a7794_tdsel[] = {
static int r8a7794_pinmux_soc_init(struct sh_pfc *pfc)
{
+ const struct soc_device_attribute *match;
+
/* Initialize TDSEL on old revisions */
- if (soc_device_match(r8a7794_tdsel))
+ match = soc_device_match(r8a7794_tdsel);
+ if (!IS_ERR(match) && match)
sh_pfc_write(pfc, 0xe6060068, 0x55555500);
return 0;
@@ -55,14 +55,19 @@ static const struct soc_device_attribute lx2160a_soc[] = {
static int dpaa2_dpio_get_cluster_sdest(struct fsl_mc_device *dpio_dev, int cpu)
{
+ const struct soc_device_attribute *match1, *match2, *match3, *match4;
int cluster_base, cluster_size;
- if (soc_device_match(ls1088a_soc)) {
+ match1 = soc_device_match(ls1088a_soc);
+ match2 = soc_device_match(ls2080a_soc);
+ match3 = soc_device_match(ls2088a_soc);
+ match4 = soc_device_match(lx2160a_soc);
+ if (!IS_ERR(match1) && match1) {
cluster_base = 2;
cluster_size = 4;
- } else if (soc_device_match(ls2080a_soc) ||
- soc_device_match(ls2088a_soc) ||
- soc_device_match(lx2160a_soc)) {
+ } else if ((!IS_ERR(match2) && match2) ||
+ (!IS_ERR(match3) && match3) ||
+ (!IS_ERR(match4) && match4)) {
cluster_base = 0;
cluster_size = 2;
} else {
@@ -36,7 +36,10 @@ static const struct soc_device_attribute r8a774c0[] __initconst = {
static int __init r8a774c0_sysc_init(void)
{
- if (soc_device_match(r8a774c0)) {
+ const struct soc_device_attribute *match;
+
+ match = soc_device_match(r8a774c0);
+ if (!IS_ERR(match) && match) {
/* Fix incorrect 3DG hierarchy */
swap(r8a774c0_areas[6], r8a774c0_areas[7]);
r8a774c0_areas[6].parent = R8A774C0_PD_ALWAYS_ON;
@@ -74,7 +74,7 @@ static int __init r8a7795_sysc_init(void)
u32 quirks = 0;
attr = soc_device_match(r8a7795_quirks_match);
- if (attr)
+ if (!IS_ERR(attr) && attr)
quirks = (uintptr_t)attr->data;
if (!(quirks & HAS_A2VC0))
@@ -36,7 +36,10 @@ static const struct soc_device_attribute r8a77990[] __initconst = {
static int __init r8a77990_sysc_init(void)
{
- if (soc_device_match(r8a77990)) {
+ const struct soc_device_attribute *match;
+
+ match = soc_device_match(r8a77990);
+ if (!IS_ERR(match) && match) {
/* Fix incorrect 3DG hierarchy */
swap(r8a77990_areas[7], r8a77990_areas[8]);
r8a77990_areas[7].parent = R8A77990_PD_ALWAYS_ON;
@@ -1368,7 +1368,7 @@ static int k3_ringacc_init(struct platform_device *pdev,
return ret;
soc = soc_device_match(k3_ringacc_socinfo);
- if (soc && soc->data) {
+ if (!IS_ERR(soc) && soc && soc->data) {
const struct k3_ringacc_soc_data *soc_data = soc->data;
ringacc->dma_ring_reset_quirk = soc_data->dma_ring_reset_quirk;
@@ -667,7 +667,7 @@ static int mt7621_pci_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&pcie->ports);
attr = soc_device_match(mt7621_pci_quirks_match);
- if (attr)
+ if (!IS_ERR(attr) && attr)
pcie->resets_inverted = true;
err = mt7621_pcie_parse_dt(pcie);
@@ -310,6 +310,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
const int *rcar_gen3_ths_tj_1 = of_device_get_match_data(dev);
struct resource *res;
struct thermal_zone_device *zone;
+ const struct soc_device_attribute *attr;
int ret, i;
/* default values if FUSEs are missing */
@@ -321,7 +322,8 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
return -ENOMEM;
priv->thermal_init = rcar_gen3_thermal_init;
- if (soc_device_match(r8a7795es1))
+ attr = soc_device_match(r8a7795es1);
+ if (!IS_ERR(attr) && attr)
priv->thermal_init = rcar_gen3_thermal_init_r8a7795es1;
platform_set_drvdata(pdev, priv);
@@ -886,6 +886,9 @@ static const struct soc_device_attribute soc_no_cpu_notifier[] = {
static
int ti_bandgap_probe(struct platform_device *pdev)
{
+#ifdef CONFIG_PM_SLEEP
+ const struct soc_device_attribute *match;
+#endif
struct ti_bandgap *bgp;
int clk_rate, ret, i;
@@ -1037,7 +1040,8 @@ int ti_bandgap_probe(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
bgp->nb.notifier_call = bandgap_omap_cpu_notifier;
- if (!soc_device_match(soc_no_cpu_notifier))
+ match = soc_device_match(soc_no_cpu_notifier);
+ if (!IS_ERR(match) && !match)
cpu_pm_register_notifier(&bgp->nb);
#endif
@@ -1072,9 +1076,11 @@ static
int ti_bandgap_remove(struct platform_device *pdev)
{
struct ti_bandgap *bgp = platform_get_drvdata(pdev);
+ const struct soc_device_attribute *attr;
int i;
- if (!soc_device_match(soc_no_cpu_notifier))
+ soc = soc_device_match(soc_no_cpu_notifier);
+ if (!IS_ERR(attr) && !attr)
cpu_pm_unregister_notifier(&bgp->nb);
/* Remove sensor interfaces */
@@ -2753,7 +2753,7 @@ static int renesas_usb3_probe(struct platform_device *pdev)
const struct soc_device_attribute *attr;
attr = soc_device_match(renesas_usb3_quirks_match);
- if (attr)
+ if (!IS_ERR(attr) && attr)
priv = attr->data;
else
priv = of_device_get_match_data(&pdev->dev);
@@ -243,6 +243,7 @@ static int ehci_platform_probe(struct platform_device *dev)
struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev);
struct ehci_platform_priv *priv;
struct ehci_hcd *ehci;
+ const struct soc_device_attribute *match;
int err, irq, clk = 0;
if (usb_disabled())
@@ -297,7 +298,8 @@ static int ehci_platform_probe(struct platform_device *dev)
"has-transaction-translator"))
hcd->has_tt = 1;
- if (soc_device_match(quirk_poll_match))
+ match = soc_device_match(quirk_poll_match);
+ if (!IS_ERR(match) && match)
priv->quirk_poll = true;
for (clk = 0; clk < EHCI_MAX_CLKS; clk++) {
@@ -135,7 +135,7 @@ static int xhci_rcar_download_firmware(struct usb_hcd *hcd)
const char *firmware_name;
attr = soc_device_match(rcar_quirks_match);
- if (attr)
+ if (!IS_ERR(attr) && attr)
quirks = (uintptr_t)attr->data;
if (quirks & RCAR_XHCI_FIRMWARE_V2)
@@ -197,7 +197,7 @@ static bool rwdt_blacklisted(struct device *dev)
const struct soc_device_attribute *attr;
attr = soc_device_match(rwdt_quirks_match);
- if (attr && setup_max_cpus > (uintptr_t)attr->data) {
+ if (!IS_ERR(attr) && attr && setup_max_cpus > (uintptr_t)attr->data) {
dev_info(dev, "Watchdog blacklisted on %s %s\n", attr->soc_id,
attr->revision);
return true;