Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [soc:board-remove 200/200] drivers/mmc/host/sdhci-pxav2.c:318 sdhci_pxav2_probe() error: we previously assumed 'variant' could be null (see line 305)
@ 2026-08-19  7:54 Dan Carpenter
  2026-08-19 11:02 ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2026-08-19  7:54 UTC (permalink / raw)
  To: oe-kbuild, Arnd Bergmann; +Cc: lkp, oe-kbuild-all, linux-arm-kernel, arm

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git board-remove
head:   c12d647b0229f4d75a2973c9b4e79f9b53406426
commit: c12d647b0229f4d75a2973c9b4e79f9b53406426 [200/200] remaining pdata removal
config: parisc-randconfig-r073-20260819 (https://download.01.org/0day-ci/archive/20260819/202608191405.jP6epa63-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 8.5.0
smatch: v0.5.0-9187-g5189e3fb

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202608191405.jP6epa63-lkp@intel.com/

smatch warnings:
drivers/mmc/host/sdhci-pxav2.c:318 sdhci_pxav2_probe() error: we previously assumed 'variant' could be null (see line 305)

vim +/variant +318 drivers/mmc/host/sdhci-pxav2.c

e41c48b4bcb3ce Doug Brown            2023-01-16  295  	clk_core = devm_clk_get_optional_enabled(dev, "core");
072f5e2c34a95b Binbin Zhou           2025-06-07  296  	if (IS_ERR(clk_core))
072f5e2c34a95b Binbin Zhou           2025-06-07  297  		return dev_err_probe(dev, PTR_ERR(clk_core),
072f5e2c34a95b Binbin Zhou           2025-06-07  298  				     "failed to enable core clock\n");
e41c48b4bcb3ce Doug Brown            2023-01-16  299  
9f5d71e4a78a02 Zhangfei Gao          2011-06-08  300  	host->quirks = SDHCI_QUIRK_BROKEN_ADMA
9f5d71e4a78a02 Zhangfei Gao          2011-06-08  301  		| SDHCI_QUIRK_BROKEN_TIMEOUT_VAL
9f5d71e4a78a02 Zhangfei Gao          2011-06-08  302  		| SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN;
9f5d71e4a78a02 Zhangfei Gao          2011-06-08  303  
dfe9746aed2d12 Doug Brown            2023-01-16  304  	variant = of_device_get_match_data(dev);
dfe9746aed2d12 Doug Brown            2023-01-16 @305  	if (variant)

This assumes "variant" can be NULL.

b650352dd3df36 Chris Ball            2012-04-10  306  		pdata = pxav2_get_mmc_pdata(dev);
dfe9746aed2d12 Doug Brown            2023-01-16  307  
9f5d71e4a78a02 Zhangfei Gao          2011-06-08  308  	if (pdata->flags & PXA_FLAG_CARD_PERMANENT) {
9f5d71e4a78a02 Zhangfei Gao          2011-06-08  309  		/* on-chip device */
9f5d71e4a78a02 Zhangfei Gao          2011-06-08  310  		host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
9f5d71e4a78a02 Zhangfei Gao          2011-06-08  311  		host->mmc->caps |= MMC_CAP_NONREMOVABLE;
9f5d71e4a78a02 Zhangfei Gao          2011-06-08  312  	}
9f5d71e4a78a02 Zhangfei Gao          2011-06-08  313  
9f5d71e4a78a02 Zhangfei Gao          2011-06-08  314  	/* If slot design supports 8 bit data, indicate this to MMC. */
9f5d71e4a78a02 Zhangfei Gao          2011-06-08  315  	if (pdata->flags & PXA_FLAG_SD_8_BIT_CAPABLE_SLOT)
9f5d71e4a78a02 Zhangfei Gao          2011-06-08  316  		host->mmc->caps |= MMC_CAP_8_BIT_DATA;
9f5d71e4a78a02 Zhangfei Gao          2011-06-08  317  
dfe9746aed2d12 Doug Brown            2023-01-16 @318  	host->quirks |= variant->extra_quirks;
dfe9746aed2d12 Doug Brown            2023-01-16  319  	host->ops = variant->ops;

But later it's dereferenced without checking.

9f5d71e4a78a02 Zhangfei Gao          2011-06-08  320  
f35ca223882aa6 Doug Brown            2023-01-16  321  	/* Set up optional pinctrl for PXA168 SDIO IRQ fix */
f35ca223882aa6 Doug Brown            2023-01-16  322  	pxav2_host->pinctrl = devm_pinctrl_get(dev);
f35ca223882aa6 Doug Brown            2023-01-16  323  	if (!IS_ERR(pxav2_host->pinctrl)) {
f35ca223882aa6 Doug Brown            2023-01-16  324  		pxav2_host->pins_cmd_gpio = pinctrl_lookup_state(pxav2_host->pinctrl,
f35ca223882aa6 Doug Brown            2023-01-16  325  								 "state_cmd_gpio");
f35ca223882aa6 Doug Brown            2023-01-16  326  		if (IS_ERR(pxav2_host->pins_cmd_gpio))
f35ca223882aa6 Doug Brown            2023-01-16  327  			pxav2_host->pins_cmd_gpio = NULL;

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



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

* Re: [soc:board-remove 200/200] drivers/mmc/host/sdhci-pxav2.c:318 sdhci_pxav2_probe() error: we previously assumed 'variant' could be null (see line 305)
  2026-08-19  7:54 [soc:board-remove 200/200] drivers/mmc/host/sdhci-pxav2.c:318 sdhci_pxav2_probe() error: we previously assumed 'variant' could be null (see line 305) Dan Carpenter
@ 2026-08-19 11:02 ` Arnd Bergmann
  2026-08-19 11:07   ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2026-08-19 11:02 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-arm-kernel, arm

On Wed, Aug 19, 2026, at 09:54, Dan Carpenter wrote:
> dfe9746aed2d12 Doug Brown            2023-01-16  304  	variant = 
> of_device_get_match_data(dev);
> dfe9746aed2d12 Doug Brown            2023-01-16 @305  	if (variant)
>
> This assumes "variant" can be NULL.
>
> dfe9746aed2d12 Doug Brown            2023-01-16  319  	host->ops = 
> variant->ops;
>
> But later it's dereferenced without checking.
>

Hi Dan,

Thanks for the report! I've fixed it up now, by removing the (now)
pointless NULL check.

As you may have seen, there are a lot of changes in this branch,
and I assume there are still many things that smatch will find here
as it is still work in progress.

If you have a list of possible regressions that smatch has already
found on this branch, I'd be happy to look through the raw data
for actual bugs and fix them before you spend a lot of time
processing the findings.

    Arnd


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

* Re: [soc:board-remove 200/200] drivers/mmc/host/sdhci-pxav2.c:318 sdhci_pxav2_probe() error: we previously assumed 'variant' could be null (see line 305)
  2026-08-19 11:02 ` Arnd Bergmann
@ 2026-08-19 11:07   ` Dan Carpenter
  2026-08-19 11:29     ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2026-08-19 11:07 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-arm-kernel, arm

On Wed, Aug 19, 2026 at 01:02:09PM +0200, Arnd Bergmann wrote:
> On Wed, Aug 19, 2026, at 09:54, Dan Carpenter wrote:
> > dfe9746aed2d12 Doug Brown            2023-01-16  304  	variant = 
> > of_device_get_match_data(dev);
> > dfe9746aed2d12 Doug Brown            2023-01-16 @305  	if (variant)
> >
> > This assumes "variant" can be NULL.
> >
> > dfe9746aed2d12 Doug Brown            2023-01-16  319  	host->ops = 
> > variant->ops;
> >
> > But later it's dereferenced without checking.
> >
> 
> Hi Dan,
> 
> Thanks for the report! I've fixed it up now, by removing the (now)
> pointless NULL check.
> 
> As you may have seen, there are a lot of changes in this branch,
> and I assume there are still many things that smatch will find here
> as it is still work in progress.
> 
> If you have a list of possible regressions that smatch has already
> found on this branch, I'd be happy to look through the raw data
> for actual bugs and fix them before you spend a lot of time
> processing the findings.

These are emails from zero day bot and I just look it over and hit
forward if the warning looks sane.  I'm re-writing Smatch like crazy
so my own results are basically useless right now.

regards,
dan carpenter



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

* Re: [soc:board-remove 200/200] drivers/mmc/host/sdhci-pxav2.c:318 sdhci_pxav2_probe() error: we previously assumed 'variant' could be null (see line 305)
  2026-08-19 11:07   ` Dan Carpenter
@ 2026-08-19 11:29     ` Arnd Bergmann
  0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2026-08-19 11:29 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-arm-kernel, arm

On Wed, Aug 19, 2026, at 13:07, Dan Carpenter wrote:
> On Wed, Aug 19, 2026 at 01:02:09PM +0200, Arnd Bergmann wrote:
>> On Wed, Aug 19, 2026, at 09:54, Dan Carpenter wrote:
>> 
>> If you have a list of possible regressions that smatch has already
>> found on this branch, I'd be happy to look through the raw data
>> for actual bugs and fix them before you spend a lot of time
>> processing the findings.
>
> These are emails from zero day bot and I just look it over and hit
> forward if the warning looks sane.  I'm re-writing Smatch like crazy
> so my own results are basically useless right now.

Ok, got it. I did receive all the zero day reports for my branch
and am already working through those.

     Arnd


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

end of thread, other threads:[~2026-08-19 11:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19  7:54 [soc:board-remove 200/200] drivers/mmc/host/sdhci-pxav2.c:318 sdhci_pxav2_probe() error: we previously assumed 'variant' could be null (see line 305) Dan Carpenter
2026-08-19 11:02 ` Arnd Bergmann
2026-08-19 11:07   ` Dan Carpenter
2026-08-19 11:29     ` Arnd Bergmann

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