From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754482Ab2HNMRV (ORCPT ); Tue, 14 Aug 2012 08:17:21 -0400 Received: from cantor2.suse.de ([195.135.220.15]:60001 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753675Ab2HNMRU (ORCPT ); Tue, 14 Aug 2012 08:17:20 -0400 Date: Tue, 14 Aug 2012 14:17:18 +0200 Message-ID: From: Takashi Iwai To: Lee Jones Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, linus.walleij@stericsson.com, arnd@arndb.de, broonie@opensource.wolfsonmicro.com, STEricsson_nomadik_linux@list.st.com Subject: Re: [alsa-devel] [PATCH 08/22] ASoC: codecs: Enable AB8500 CODEC for Device Tree In-Reply-To: <1344527268-5964-9-git-send-email-lee.jones@linaro.org> References: <1344527268-5964-1-git-send-email-lee.jones@linaro.org> <1344527268-5964-9-git-send-email-lee.jones@linaro.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.1 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Thu, 9 Aug 2012 16:47:34 +0100, Lee Jones wrote: > @@ -2407,6 +2464,30 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec) > /* Setup AB8500 according to board-settings */ > pdata = (struct ab8500_platform_data *)dev_get_platdata(dev->parent); > > + if (np) { > + if (!pdata) > + pdata = devm_kzalloc(dev, > + sizeof(struct ab8500_platform_data), > + GFP_KERNEL); > + > + if (!pdata->codec) The NULL check of pdata must be before pdata->codec access. Takashi > + pdata->codec > + = devm_kzalloc(dev, > + sizeof(struct ab8500_codec_platform_data), > + GFP_KERNEL); > + > + if (!(pdata && pdata->codec)) > + return -ENOMEM; > + > + ab8500_codec_of_probe(dev, np, pdata->codec); > + > + } else { > + if (!(pdata && pdata->codec)) { > + dev_err(dev, "No codec platform data or DT found\n"); > + return -EINVAL; > + } > + } > + > /* Inform SoC Core that we have our own I/O arrangements. */ > codec->control_data = (void *)true; > > -- > 1.7.9.5 > > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel >