diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c index 530017f7d14a89ed1702fa25f72bded555bcb526..af5734f6dab7093e0459ce82cb0e33f39068ce29 100644 --- a/sound/soc/mxs/mxs-saif.c +++ b/sound/soc/mxs/mxs-saif.c @@ -521,12 +521,13 @@ static int mxs_saif_probe(struct platform_device *pdev) struct mxs_saif *saif; int ret = 0; + if (pdev->id >= ARRAY_SIZE(mxs_saif)) + return -EINVAL; + saif = kzalloc(sizeof(*saif), GFP_KERNEL); if (!saif) return -ENOMEM; - if (pdev->id >= ARRAY_SIZE(mxs_saif)) - return -EINVAL; mxs_saif[pdev->id] = saif; saif->clk = clk_get(&pdev->dev, NULL);