mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-uhs2: Remove unnecessary NULL check
@ 2024-10-30  1:53 Ben Chuang
  2024-10-30  9:41 ` Adrian Hunter
  2024-10-30 11:07 ` Ulf Hansson
  0 siblings, 2 replies; 3+ messages in thread
From: Ben Chuang @ 2024-10-30  1:53 UTC (permalink / raw)
  To: adrian.hunter, ulf.hansson
  Cc: linux-mmc, linux-kernel, ben.chuang, benchuanggli, greg.tu,
	HL.Liu, victor.shih, dan.carpenter, takahiro.akashi

From: Ben Chuang <ben.chuang@genesyslogic.com.tw>

The "host->ops" pointer points to an offset into the "sdhci_ops" struct
so it cannot be NULL. Remove "host->ops" check in "if" statement.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202410271835.tqz9s9JV-lkp@intel.com/
Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw>
---
 drivers/mmc/host/sdhci-uhs2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
index c488c6d56015..b0e4ab852a94 100644
--- a/drivers/mmc/host/sdhci-uhs2.c
+++ b/drivers/mmc/host/sdhci-uhs2.c
@@ -413,7 +413,7 @@ static int sdhci_uhs2_do_detect_init(struct mmc_host *mmc)
 
 	DBG("Begin do uhs2 detect init.\n");
 
-	if (host->ops && host->ops->uhs2_pre_detect_init)
+	if (host->ops->uhs2_pre_detect_init)
 		host->ops->uhs2_pre_detect_init(host);
 
 	if (sdhci_uhs2_interface_detect(host)) {
-- 
2.47.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: sdhci-uhs2: Remove unnecessary NULL check
  2024-10-30  1:53 [PATCH] mmc: sdhci-uhs2: Remove unnecessary NULL check Ben Chuang
@ 2024-10-30  9:41 ` Adrian Hunter
  2024-10-30 11:07 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Adrian Hunter @ 2024-10-30  9:41 UTC (permalink / raw)
  To: Ben Chuang, ulf.hansson
  Cc: linux-mmc, linux-kernel, ben.chuang, greg.tu, HL.Liu,
	victor.shih, dan.carpenter, takahiro.akashi

On 30/10/24 03:53, Ben Chuang wrote:
> From: Ben Chuang <ben.chuang@genesyslogic.com.tw>
> 
> The "host->ops" pointer points to an offset into the "sdhci_ops" struct
> so it cannot be NULL. Remove "host->ops" check in "if" statement.

It is a pointer, so it could be NULL, but it never will be in this
function.

> 
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/r/202410271835.tqz9s9JV-lkp@intel.com/
> Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw>

Apart from commit message:

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-uhs2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
> index c488c6d56015..b0e4ab852a94 100644
> --- a/drivers/mmc/host/sdhci-uhs2.c
> +++ b/drivers/mmc/host/sdhci-uhs2.c
> @@ -413,7 +413,7 @@ static int sdhci_uhs2_do_detect_init(struct mmc_host *mmc)
>  
>  	DBG("Begin do uhs2 detect init.\n");
>  
> -	if (host->ops && host->ops->uhs2_pre_detect_init)
> +	if (host->ops->uhs2_pre_detect_init)
>  		host->ops->uhs2_pre_detect_init(host);
>  
>  	if (sdhci_uhs2_interface_detect(host)) {


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: sdhci-uhs2: Remove unnecessary NULL check
  2024-10-30  1:53 [PATCH] mmc: sdhci-uhs2: Remove unnecessary NULL check Ben Chuang
  2024-10-30  9:41 ` Adrian Hunter
@ 2024-10-30 11:07 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2024-10-30 11:07 UTC (permalink / raw)
  To: Ben Chuang
  Cc: adrian.hunter, linux-mmc, linux-kernel, ben.chuang, greg.tu,
	HL.Liu, victor.shih, dan.carpenter, takahiro.akashi

On Wed, 30 Oct 2024 at 02:54, Ben Chuang <benchuanggli@gmail.com> wrote:
>
> From: Ben Chuang <ben.chuang@genesyslogic.com.tw>
>
> The "host->ops" pointer points to an offset into the "sdhci_ops" struct
> so it cannot be NULL. Remove "host->ops" check in "if" statement.
>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/r/202410271835.tqz9s9JV-lkp@intel.com/
> Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw>

Applied for next and by amending the commit message a bit, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci-uhs2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
> index c488c6d56015..b0e4ab852a94 100644
> --- a/drivers/mmc/host/sdhci-uhs2.c
> +++ b/drivers/mmc/host/sdhci-uhs2.c
> @@ -413,7 +413,7 @@ static int sdhci_uhs2_do_detect_init(struct mmc_host *mmc)
>
>         DBG("Begin do uhs2 detect init.\n");
>
> -       if (host->ops && host->ops->uhs2_pre_detect_init)
> +       if (host->ops->uhs2_pre_detect_init)
>                 host->ops->uhs2_pre_detect_init(host);
>
>         if (sdhci_uhs2_interface_detect(host)) {
> --
> 2.47.0
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-30 11:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-30  1:53 [PATCH] mmc: sdhci-uhs2: Remove unnecessary NULL check Ben Chuang
2024-10-30  9:41 ` Adrian Hunter
2024-10-30 11:07 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®