From patchwork Wed Sep 23 15:37:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11795151 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF22A6CB for ; Wed, 23 Sep 2020 15:37:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99D792220D for ; Wed, 23 Sep 2020 15:37:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600875478; bh=LZ8zZkcDT5bZVhoFGcs01ikRZlzBKlzCeMK3BbwqAPM=; h=From:To:Cc:Subject:Date:List-ID:From; b=FOf6fkOsMtY0jJQ/Qqehl3CZepI45rSR0aoJ9VmtaFnJF19lMC3LZ3sDgoFr3HIas bfJO2Lou2s8ItEI1SgArNey4TZNFC576d3ug02h37JLWPLd8Cbe7r4fjNOf+fUl0xT tOr74P5At0Z+PFmUDHCeMPKQKFcVx4r5xLtFC/R0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726693AbgIWPh6 (ORCPT ); Wed, 23 Sep 2020 11:37:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:40124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726689AbgIWPh6 (ORCPT ); Wed, 23 Sep 2020 11:37:58 -0400 Received: from localhost.localdomain (unknown [194.230.155.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DAD1421D41; Wed, 23 Sep 2020 15:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600875477; bh=LZ8zZkcDT5bZVhoFGcs01ikRZlzBKlzCeMK3BbwqAPM=; h=From:To:Cc:Subject:Date:From; b=HzN/sn/PsFetsFC5y98ujOl+NUKWBnVEoUjvIIhM6JlYlpxBDZ6Zdoihix3Zxoi17 uSDGJV8rA/GDq/ioNGSQK7dkwG+kqimuZpEAvlzAyFFV4vyfPq/Dc7EFENaYiPLERu U87FTK+pjCIJmdbFoSeGM8Jltqn66/8Hi1EdlOPs= From: Krzysztof Kozlowski To: Ulf Hansson , Adrian Hunter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Orson Zhai , Baolin Wang , Chunyan Zhang , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Krzysztof Kozlowski Subject: [PATCH 1/2] mmc: moxart: remove unneeded check for drvdata Date: Wed, 23 Sep 2020 17:37:38 +0200 Message-Id: <20200923153739.30327-1-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org The 'struct mmc_host *mmc' comes from drvdata set at the end of probe, so it cannot be NULL. The code already dereferences it few lines before the check with mmc_priv(). This also fixes smatch warning: drivers/mmc/host/moxart-mmc.c:692 moxart_remove() warn: variable dereferenced before check 'mmc' (see line 688) Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Krzysztof Kozlowski --- drivers/mmc/host/moxart-mmc.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c index 2bfb376fddc4..f25079ba3bca 100644 --- a/drivers/mmc/host/moxart-mmc.c +++ b/drivers/mmc/host/moxart-mmc.c @@ -689,19 +689,18 @@ static int moxart_remove(struct platform_device *pdev) dev_set_drvdata(&pdev->dev, NULL); - if (mmc) { - if (!IS_ERR(host->dma_chan_tx)) - dma_release_channel(host->dma_chan_tx); - if (!IS_ERR(host->dma_chan_rx)) - dma_release_channel(host->dma_chan_rx); - mmc_remove_host(mmc); - mmc_free_host(mmc); + if (!IS_ERR(host->dma_chan_tx)) + dma_release_channel(host->dma_chan_tx); + if (!IS_ERR(host->dma_chan_rx)) + dma_release_channel(host->dma_chan_rx); + mmc_remove_host(mmc); + mmc_free_host(mmc); + + writel(0, host->base + REG_INTERRUPT_MASK); + writel(0, host->base + REG_POWER_CONTROL); + writel(readl(host->base + REG_CLOCK_CONTROL) | CLK_OFF, + host->base + REG_CLOCK_CONTROL); - writel(0, host->base + REG_INTERRUPT_MASK); - writel(0, host->base + REG_POWER_CONTROL); - writel(readl(host->base + REG_CLOCK_CONTROL) | CLK_OFF, - host->base + REG_CLOCK_CONTROL); - } return 0; } From patchwork Wed Sep 23 15:37:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11795153 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 314BE6CB for ; Wed, 23 Sep 2020 15:38:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C4B821D7D for ; Wed, 23 Sep 2020 15:38:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600875487; bh=l07TPT43InyARN6scqTSWGPtscU6HSFhdJX+X1kj2fE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Rm12KDUAzwuhFXk5k+308tbr5JtVJ0Za0Oo4oedG67BdMGtSD6tnw7NnWGfMElET1 INk+mT5VwIHxvAQ7hDV4GW3Y7gUPwPxWEJqspjulg4vs6O13AZBBIxkUwBZMHj80In WFnqNwH7zspWnlJyZNbFWsPoHmaWEDeWsAUAB2tc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726748AbgIWPiG (ORCPT ); Wed, 23 Sep 2020 11:38:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:40472 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726184AbgIWPiE (ORCPT ); Wed, 23 Sep 2020 11:38:04 -0400 Received: from localhost.localdomain (unknown [194.230.155.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1E4AA21D7D; Wed, 23 Sep 2020 15:37:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600875484; bh=l07TPT43InyARN6scqTSWGPtscU6HSFhdJX+X1kj2fE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WQeM+s1HExyF+P5owYL+tElH+HGTWXQomdp6r8SbZv4J0c10DjlBBRtWlmYOar/vE m1clvo+xIgczTmirMXWTjW8OaNr9+s6m4LqZAQH4H4pxfCMGgMsSHm/Er1fEafg0S8 9Mj7aQ5Y7a0w1oGXZXLiDjBcfJgvBZPaKzICLwrg= From: Krzysztof Kozlowski To: Ulf Hansson , Adrian Hunter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Orson Zhai , Baolin Wang , Chunyan Zhang , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Krzysztof Kozlowski Subject: [PATCH 2/2] mmc: sdhci: fix indentation mistakes Date: Wed, 23 Sep 2020 17:37:39 +0200 Message-Id: <20200923153739.30327-2-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200923153739.30327-1-krzk@kernel.org> References: <20200923153739.30327-1-krzk@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Fix inconsistent indenting, reported by Smatch: drivers/mmc/host/sdhci-esdhc-imx.c:1380 sdhci_esdhc_imx_hwinit() warn: inconsistent indenting drivers/mmc/host/sdhci-sprd.c:390 sdhci_sprd_request_done() warn: inconsistent indenting Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Krzysztof Kozlowski --- drivers/mmc/host/sdhci-esdhc-imx.c | 2 +- drivers/mmc/host/sdhci-sprd.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 62b3d4767916..fce8fa7e6b30 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1377,7 +1377,7 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host) * response, block the tuning procedure or the first command * after the whole tuning procedure always can't get any response. */ - tmp |= ESDHC_TUNING_CMD_CRC_CHECK_DISABLE; + tmp |= ESDHC_TUNING_CMD_CRC_CHECK_DISABLE; writel(tmp, host->ioaddr + ESDHC_TUNING_CTRL); } else if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING) { /* diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c index 1efaf602c206..58109c5b53e2 100644 --- a/drivers/mmc/host/sdhci-sprd.c +++ b/drivers/mmc/host/sdhci-sprd.c @@ -387,7 +387,7 @@ static void sdhci_sprd_request_done(struct sdhci_host *host, if (mmc_hsq_finalize_request(host->mmc, mrq)) return; - mmc_request_done(host->mmc, mrq); + mmc_request_done(host->mmc, mrq); } static struct sdhci_ops sdhci_sprd_ops = { @@ -433,7 +433,7 @@ static void sdhci_sprd_request(struct mmc_host *mmc, struct mmc_request *mrq) } static int sdhci_sprd_request_atomic(struct mmc_host *mmc, - struct mmc_request *mrq) + struct mmc_request *mrq) { sdhci_sprd_check_auto_cmd23(mmc, mrq);