From patchwork Thu Dec 19 15:55:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 22641 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 61F7223FCA for ; Thu, 19 Dec 2013 15:55:35 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id kl14sf3355603pab.6 for ; Thu, 19 Dec 2013 07:55:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=qTlZxswlrOiAcAbcREDRAH4UOiuA9H74nPf/w0wH9rs=; b=a/gsstdYrZ98CY7hS/3JSLbZxmz1Ijwdfh8MX2sWJyDvwbamXCT9J/iW07L+KpqOFa 9hoTYebPM5XxKthbq4bDnS8gToVBdZtjQSvM/HdTx0RyFDqAqE689JHxY/qICb0faseg 22bJWJ4+UFYm3gfYj+Pm2y3my2Mhvl2MuWEZirQDqRq5opfMvsC7udLDyIyjmpvMERYD eLT/F8hezUO7rki/FJMt+uLb1U5ue00GnyE3AV9d1X1lSk5e0E5c42xQZ8rc6XS3UzW9 /a/7daEmsYTa5xMzLra9XvUCocOhJp6jEs0s1+KfBUHRgZ4o6+/hzB1qYBoUth1sy0fm 6A4A== X-Gm-Message-State: ALoCoQnhq6n4qbU4aqlIorsA6KeUTf0u/HvE0ibNSIflkkTDQ7HroQmK8LfRREU7NPSp0uFUimiO X-Received: by 10.66.190.38 with SMTP id gn6mr1175882pac.30.1387468534446; Thu, 19 Dec 2013 07:55:34 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.106.132 with SMTP id gu4ls393790qeb.8.gmail; Thu, 19 Dec 2013 07:55:34 -0800 (PST) X-Received: by 10.58.168.205 with SMTP id zy13mr1301902veb.19.1387468534255; Thu, 19 Dec 2013 07:55:34 -0800 (PST) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id sx7si778292vdc.68.2013.12.19.07.55.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Dec 2013 07:55:34 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id ik5so780112vcb.30 for ; Thu, 19 Dec 2013 07:55:34 -0800 (PST) X-Received: by 10.58.210.66 with SMTP id ms2mr1426681vec.10.1387468534139; Thu, 19 Dec 2013 07:55:34 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp331337ved; Thu, 19 Dec 2013 07:55:33 -0800 (PST) X-Received: by 10.194.94.167 with SMTP id dd7mr2083695wjb.43.1387468532832; Thu, 19 Dec 2013 07:55:32 -0800 (PST) Received: from mail-we0-f171.google.com (mail-we0-f171.google.com [74.125.82.171]) by mx.google.com with ESMTPS id gv8si1897903wib.2.2013.12.19.07.55.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Dec 2013 07:55:32 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.171 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.171; Received: by mail-we0-f171.google.com with SMTP id q58so1285239wes.16 for ; Thu, 19 Dec 2013 07:55:32 -0800 (PST) X-Received: by 10.194.241.228 with SMTP id wl4mr2263302wjc.2.1387468532358; Thu, 19 Dec 2013 07:55:32 -0800 (PST) Received: from localhost.localdomain (cpc15-aztw25-2-0-cust493.aztw.cable.virginm.net. [92.233.57.238]) by mx.google.com with ESMTPSA id ko3sm279236wjb.23.2013.12.19.07.55.30 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Dec 2013 07:55:31 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: linus.walleij@linaro.org, broonie@kernel.org, alsa-devel@alsa-project.org, Lee Jones Subject: [PATCH 03/11] ASoC: ux500: Provide better checking for Device Tree and/or Platform Data Date: Thu, 19 Dec 2013 15:55:00 +0000 Message-Id: <1387468508-12286-4-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1387468508-12286-1-git-send-email-lee.jones@linaro.org> References: <1387468508-12286-1-git-send-email-lee.jones@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , These drivers will not work without platform specific data, which is passed in via Device Tree or Platform Data. To avoid the chance of NULL pointer dereferencing and alike, let's ensure we have at least one of the methods in play before continuing. Signed-off-by: Lee Jones --- sound/soc/ux500/ux500_msp_dai.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c index c6fb5cc..bc042cc 100644 --- a/sound/soc/ux500/ux500_msp_dai.c +++ b/sound/soc/ux500/ux500_msp_dai.c @@ -771,10 +771,14 @@ static const struct snd_soc_component_driver ux500_msp_component = { static int ux500_msp_drv_probe(struct platform_device *pdev) { struct ux500_msp_i2s_drvdata *drvdata; + struct msp_i2s_platform_data *pdata = pdev->dev.platform_data; + struct device_node *np = pdev->dev.of_node; int ret = 0; - dev_dbg(&pdev->dev, "%s: Enter (pdev->name = %s).\n", __func__, - pdev->name); + if (!pdata && !np) { + dev_err(&pdev->dev, "No platform data or Device Tree found\n"); + return -ENODEV; + } drvdata = devm_kzalloc(&pdev->dev, sizeof(struct ux500_msp_i2s_drvdata),