Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp149487pxb; Fri, 8 Jan 2021 00:56:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyAi9rP4jWmz6VKfqD4a4xM9qx8PE2SH+rZAaS+PSgyWU7eAZjOWwMImUOkd2AopR4C4oaB X-Received: by 2002:a50:f0dc:: with SMTP id a28mr4577528edm.291.1610096174575; Fri, 08 Jan 2021 00:56:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610096174; cv=none; d=google.com; s=arc-20160816; b=SeMq9l1qY1xVfgrRWdsZE+XiyMG2Y4XfDU+YcuqTjTP/BeEmNJmS2N+XoNGKkssJML lNlMGLKP/6rlpCP2Esxg7piFTtYpXuxoZ6RXi6KWAGgalSOki9NwKHvrZp5UimGe1vkI SLCjzvoW28Mk5ODOqgPw/EzBarpBhRb9vNZxOn4bojzx/y8arsXK80hQdmHfdm9e+g33 zgBk/uorGf0t5jF2livpBpquhQW1PSaU7vvVYTVrXuZKB3Y/6MjnmXk5yCWuPf2BWUrc pmIMwC+97NBUoIi5RESnCTKP6AoZUkHn6u1NTqHwRIj7RoHcFES8AA/tDUQaywt5Z6kM Wncw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=Uw1N1u9aqZ1D97PjwVb5fSnjnYpv8LCzmmFkz8MRlwM=; b=hbsUGEZe66f0aMhFTWjADorLxS/h0c8fFLqMu79251ITeO5dm/95EeYAp5syrBDP0Y MVjWWVI4PT9t7DJQPb0Qq7wgF/krejJdjtmKvkfEuToyzQqOw1a65T1QUvJfWoAzFozi ulPkxSkeqnv9R6pFCyqoS/QxuJAZhyHIAaFZ5/WbhrpG8loOkChTRUNfRfmyutkkb8z+ dTUH3ve9kLu5p5ovK5l20Mfw27gsrKFoN0WPzpl5++8bebK9nJZYb5s/jInoneo657/n ESp4tFN6o8fxb4oAxhMd6AwLnnUfD95wzKy2YBAREFDHt7vp1mRvjnfgRMmRGNZgR/TP 5qyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z17si3213704ejf.132.2021.01.08.00.55.50; Fri, 08 Jan 2021 00:56:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727705AbhAHIyX (ORCPT + 99 others); Fri, 8 Jan 2021 03:54:23 -0500 Received: from smtp21.cstnet.cn ([159.226.251.21]:32832 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726120AbhAHIyX (ORCPT ); Fri, 8 Jan 2021 03:54:23 -0500 Received: from localhost.localdomain (unknown [124.16.141.241]) by APP-01 (Coremail) with SMTP id qwCowADHzxOCHfhf2ImaAQ--.7931S2; Fri, 08 Jan 2021 16:53:22 +0800 (CST) From: Xu Wang To: support.opensource@diasemi.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: codecs: da*: Remove redundant null check before clk_prepare_enable/clk_disable_unprepare Date: Fri, 8 Jan 2021 08:53:19 +0000 Message-Id: <20210108085319.6912-1-vulab@iscas.ac.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: qwCowADHzxOCHfhf2ImaAQ--.7931S2 X-Coremail-Antispam: 1UD129KBjvJXoWxZr1UKFW5ZFWftF4DZrW8Zwb_y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List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Because clk_prepare_enable() and clk_disable_unprepare() already checked NULL clock parameter, so the additional checks are unnecessary, just remove them. Signed-off-by: Xu Wang --- sound/soc/codecs/da7218.c | 13 +++++-------- sound/soc/codecs/da7219-aad.c | 19 ++++++++----------- sound/soc/codecs/da7219.c | 3 +-- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c index 2bfafbe9e3dc..324d95e3b48a 100644 --- a/sound/soc/codecs/da7218.c +++ b/sound/soc/codecs/da7218.c @@ -2582,12 +2582,10 @@ static int da7218_set_bias_level(struct snd_soc_component *component, case SND_SOC_BIAS_PREPARE: /* Enable MCLK for transition to ON state */ if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_STANDBY) { - if (da7218->mclk) { - ret = clk_prepare_enable(da7218->mclk); - if (ret) { - dev_err(component->dev, "Failed to enable mclk\n"); - return ret; - } + ret = clk_prepare_enable(da7218->mclk); + if (ret) { + dev_err(component->dev, "Failed to enable mclk\n"); + return ret; } } @@ -2605,8 +2603,7 @@ static int da7218_set_bias_level(struct snd_soc_component *component, DA7218_LDO_EN_MASK); } else { /* Remove MCLK */ - if (da7218->mclk) - clk_disable_unprepare(da7218->mclk); + clk_disable_unprepare(da7218->mclk); } break; case SND_SOC_BIAS_OFF: diff --git a/sound/soc/codecs/da7219-aad.c b/sound/soc/codecs/da7219-aad.c index 48081d71c22c..fa61cfc8e50c 100644 --- a/sound/soc/codecs/da7219-aad.c +++ b/sound/soc/codecs/da7219-aad.c @@ -123,15 +123,13 @@ static void da7219_aad_hptest_work(struct work_struct *work) mutex_lock(&da7219->pll_lock); /* Ensure MCLK is available for HP test procedure */ - if (da7219->mclk) { - ret = clk_prepare_enable(da7219->mclk); - if (ret) { - dev_err(component->dev, "Failed to enable mclk - %d\n", ret); - mutex_unlock(&da7219->pll_lock); - mutex_unlock(&da7219->ctrl_lock); - snd_soc_dapm_mutex_unlock(dapm); - return; - } + ret = clk_prepare_enable(da7219->mclk); + if (ret) { + dev_err(component->dev, "Failed to enable mclk - %d\n", ret); + mutex_unlock(&da7219->pll_lock); + mutex_unlock(&da7219->ctrl_lock); + snd_soc_dapm_mutex_unlock(dapm); + return; } /* @@ -318,8 +316,7 @@ static void da7219_aad_hptest_work(struct work_struct *work) da7219_set_pll(component, DA7219_SYSCLK_MCLK, 0); /* Remove MCLK, if previously enabled */ - if (da7219->mclk) - clk_disable_unprepare(da7219->mclk); + clk_disable_unprepare(da7219->mclk); mutex_unlock(&da7219->pll_lock); mutex_unlock(&da7219->ctrl_lock); diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c index e9b45daec0ca..50307cc9d640 100644 --- a/sound/soc/codecs/da7219.c +++ b/sound/soc/codecs/da7219.c @@ -1826,8 +1826,7 @@ static int da7219_set_bias_level(struct snd_soc_component *component, if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_PREPARE) { /* Remove MCLK */ - if (da7219->mclk) - clk_disable_unprepare(da7219->mclk); + clk_disable_unprepare(da7219->mclk); } break; case SND_SOC_BIAS_OFF: -- 2.17.1