From patchwork Mon Jul 12 06:11:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 473854 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F8E2C07E9B for ; Mon, 12 Jul 2021 07:23:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A0716192C for ; Mon, 12 Jul 2021 07:23:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243765AbhGLH01 (ORCPT ); Mon, 12 Jul 2021 03:26:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:34614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343885AbhGLHYX (ORCPT ); Mon, 12 Jul 2021 03:24:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C65C5613EB; Mon, 12 Jul 2021 07:21:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626074483; bh=pjgfzuIKSAXErgEX1VxWWkwHk0mgV0KIJDJUBjsg+lQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sY0RBjOrQTpJTWzmyaO1jlQGeREbKRkKYJ0GJt2aI530M/ziL5lUlQwaAdf9YVGXE 2hYbU54KTrnVlo3KdjP0OwXh/E6Xa11CiKJ5wOzJVV+swiaLtjrXUaO+6DHcIKiLA3 F8wRqpBt6kpvQtXSaZ1S+eNwARhmRRXwgBfpjnIc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Guennadi Liakhovetski , Bard Liao , Mark Brown , Sasha Levin Subject: [PATCH 5.12 596/700] ASoC: max98373-sdw: add missing memory allocation check Date: Mon, 12 Jul 2021 08:11:19 +0200 Message-Id: <20210712061039.359226556@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Pierre-Louis Bossart [ Upstream commit 468a272ca49cc4e2f58f3c360643c3f6d313c146 ] We forgot to test that devm_kcalloc doesn't return NULL. Fixes: 349dd23931d1 ('ASoC: max98373: don't access volatile registers in bias level off') Signed-off-by: Pierre-Louis Bossart Reviewed-by: Guennadi Liakhovetski Reviewed-by: Bard Liao Link: https://lore.kernel.org/r/20210607222239.582139-2-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/max98373-sdw.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/codecs/max98373-sdw.c b/sound/soc/codecs/max98373-sdw.c index f3a12205cd48..c7a3506046db 100644 --- a/sound/soc/codecs/max98373-sdw.c +++ b/sound/soc/codecs/max98373-sdw.c @@ -787,6 +787,8 @@ static int max98373_init(struct sdw_slave *slave, struct regmap *regmap) max98373->cache = devm_kcalloc(dev, max98373->cache_num, sizeof(*max98373->cache), GFP_KERNEL); + if (!max98373->cache) + return -ENOMEM; for (i = 0; i < max98373->cache_num; i++) max98373->cache[i].reg = max98373_sdw_cache_reg[i];