Message ID | 20221117103223.74425-1-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp323051wrr; Thu, 17 Nov 2022 02:33:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf6utPRlfRVUaRFDtZU2/b1mlCP/cTMjeMu5RB0/qEomWdFfL5pKuzbQp6COU6Zv/xkIIDga X-Received: by 2002:a17:906:830d:b0:79e:5ea1:4f83 with SMTP id j13-20020a170906830d00b0079e5ea14f83mr1540647ejx.372.1668681237977; Thu, 17 Nov 2022 02:33:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668681237; cv=none; d=google.com; s=arc-20160816; b=ZufduRDTtM7FQBPm6WJzcF1ii26wJtfCJGk7ta85ibZ+/naBTaC8w73cjO+I/LBpns j8CxlYoVBDMSndBAg/8A/6LsKiuCc+bkuGtfaQUrU5xInR+/TKkfgn3t3/TOmyGLFOBz hviwxtDsNdFzxLzT7BEyGFJaVs8uaH9bfpJLjPEzannRzPHfQ5u25ZWpBAZ6xVIFIsfj B78rv+JagBfNF9ddCS3de3kjg5+WB5bn+tHx/4OXovK4qLAIXnsIHFq1rxd8BXpqmHHq rR/sGxkgpOlA7TeT97kCV7/i1lU87BFSUZ7oDThR5n7xrZn+ct3W7AatCR8YzRSDClox C+OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=lRg2dbJRJPug5kMS5w3eVi3Ze6R+dB9YAf7cNYhxqQU=; b=rQf4tTua0NO2JMdW5bSMnhYzjifbLGGpi636Gi0a2Fz4g1U3OJvVUZTzIE38cC4u7b 3Ad8y1zeKxByyKGswMpQ/TnsawrZmLykdh4eLtcdjg5G6ylwA5ySG6NRVjONIYY73cpb ShJ8XPgmEf5gktUMeW2HXWifTs+tiICWP8rKgRB5wbYzUBRxxNXVTWA2F9SS6nAyrN3J b1ZGR10FAXMK3eHsiXAijW04bj/wCGe5A2X74BRbIVDlwnnMGCS0nESKzbJ6iWPSxt9q CaftnYlwpdsOkK6CVKNKsLqbl76tBgs2bvGDdJFynu+YZgzT9fqKz7CDb5RPP8POVKzB q+PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="VOX/qhzP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz5-20020a1709072ce500b007832270e88fsi270797ejc.681.2022.11.17.02.33.34; Thu, 17 Nov 2022 02:33:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="VOX/qhzP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239477AbiKQKcI (ORCPT <rfc822;just.gull.subs@gmail.com> + 99 others); Thu, 17 Nov 2022 05:32:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233223AbiKQKcG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 17 Nov 2022 05:32:06 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A060D59841 for <linux-kernel@vger.kernel.org>; Thu, 17 Nov 2022 02:32:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668681125; x=1700217125; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=CpdbmDBh5RulsmM2sjgVaOibIHHXUwZtdOLMVaFIP3s=; b=VOX/qhzPKdmAkjNnvjIFY7DCgGuB4QFDBISFaQ3Gaw8/jwSwfFTVjeVV CPMOHoRqHesTRDGq4/5FI6SLJoCc9i8r+RoN9fIhIV6lXSNTYjjj6OgJv HmeZvWPTpEwIUaCQYVXu0gL/zMiy1IiRi7dCEtAHqjYsrXSUIgjbVHH0d neq21ATMkBY85X5dEl8GdK9TFeHl9pwWb9UAXI2klubDKsiyN5AtGgpvw yjNzCRWGi1FOs2jnO0EOQiF7ZW1hbVsuGbBHNUfDnrVFdFBOQqRZEWD0w ThXQQbsmiWGm4a+MjHaXHFGRdpjTixeUrbf1IwNK8TfM2poRoUc1QX4X4 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10533"; a="313965339" X-IronPort-AV: E=Sophos;i="5.96,171,1665471600"; d="scan'208";a="313965339" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2022 02:32:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10533"; a="764711982" X-IronPort-AV: E=Sophos;i="5.96,171,1665471600"; d="scan'208";a="764711982" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 17 Nov 2022 02:32:01 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id E866810E; Thu, 17 Nov 2022 12:32:25 +0200 (EET) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Mark Brown <broonie@kernel.org>, Peter Ujfalusi <peter.ujfalusi@linux.intel.com>, Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>, Ranjani Sridharan <ranjani.sridharan@linux.intel.com>, Jyri Sarha <jyri.sarha@intel.com>, sound-open-firmware@alsa-project.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Liam Girdwood <lgirdwood@gmail.com>, Bard Liao <yung-chuan.liao@linux.intel.com>, Kai Vehmanen <kai.vehmanen@linux.intel.com>, Daniel Baluta <daniel.baluta@nxp.com>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, Andy Shevchenko <andriy.shevchenko@linux.intel.com> Subject: [PATCH v1 1/1] ASoC: SOF: probes: Check ops before memory allocation Date: Thu, 17 Nov 2022 12:32:23 +0200 Message-Id: <20221117103223.74425-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749739097804449065?= X-GMAIL-MSGID: =?utf-8?q?1749739097804449065?= |
Series |
[v1,1/1] ASoC: SOF: probes: Check ops before memory allocation
|
|
Commit Message
Andy Shevchenko
Nov. 17, 2022, 10:32 a.m. UTC
We may check ops before spending resources on memory allocation.
While at it, utilize dev_get_platdata() helper.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
sound/soc/sof/sof-client-probes.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
Comments
On 17/11/2022 12:32, Andy Shevchenko wrote: > We may check ops before spending resources on memory allocation. we might. Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> > While at it, utilize dev_get_platdata() helper. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > sound/soc/sof/sof-client-probes.c | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) > > diff --git a/sound/soc/sof/sof-client-probes.c b/sound/soc/sof/sof-client-probes.c > index d08395182b1a..fff126808bc0 100644 > --- a/sound/soc/sof/sof-client-probes.c > +++ b/sound/soc/sof/sof-client-probes.c > @@ -399,23 +399,21 @@ static int sof_probes_client_probe(struct auxiliary_device *auxdev, > if (!sof_probes_enabled) > return -ENXIO; > > - if (!dev->platform_data) { > + ops = dev_get_platdata(dev); > + if (!ops) { > dev_err(dev, "missing platform data\n"); > return -ENODEV; > } > - > - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); > - if (!priv) > - return -ENOMEM; > - > - ops = dev->platform_data; > - > if (!ops->startup || !ops->shutdown || !ops->set_params || !ops->trigger || > !ops->pointer) { > dev_err(dev, "missing platform callback(s)\n"); > return -ENODEV; > } > > + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); > + if (!priv) > + return -ENOMEM; > + > priv->host_ops = ops; > > switch (sof_client_get_ipc_type(cdev)) {
On Thu, 17 Nov 2022 12:32:23 +0200, Andy Shevchenko wrote: > We may check ops before spending resources on memory allocation. > While at it, utilize dev_get_platdata() helper. > > Applied to broonie/sound.git for-next Thanks! [1/1] ASoC: SOF: probes: Check ops before memory allocation commit: 82b21ca1912723a53534086864ee0daceb604cb5 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
diff --git a/sound/soc/sof/sof-client-probes.c b/sound/soc/sof/sof-client-probes.c index d08395182b1a..fff126808bc0 100644 --- a/sound/soc/sof/sof-client-probes.c +++ b/sound/soc/sof/sof-client-probes.c @@ -399,23 +399,21 @@ static int sof_probes_client_probe(struct auxiliary_device *auxdev, if (!sof_probes_enabled) return -ENXIO; - if (!dev->platform_data) { + ops = dev_get_platdata(dev); + if (!ops) { dev_err(dev, "missing platform data\n"); return -ENODEV; } - - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; - - ops = dev->platform_data; - if (!ops->startup || !ops->shutdown || !ops->set_params || !ops->trigger || !ops->pointer) { dev_err(dev, "missing platform callback(s)\n"); return -ENODEV; } + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + priv->host_ops = ops; switch (sof_client_get_ipc_type(cdev)) {