* [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
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2026-08-19 6:42 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-arm-kernel@lists.infradead.org
CC: arm@kernel.org
TO: Arnd Bergmann <arnd@arndb.de>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git board-remove
head: c12d647b0229f4d75a2973c9b4e79f9b53406426
commit: c12d647b0229f4d75a2973c9b4e79f9b53406426 [200/200] remaining pdata removal
:::::: branch date: 16 hours ago
:::::: commit date: 16 hours ago
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
b650352dd3df36 Chris Ball 2012-04-10 269
c3be1efd41a97f Bill Pemberton 2012-11-19 270 static int sdhci_pxav2_probe(struct platform_device *pdev)
9f5d71e4a78a02 Zhangfei Gao 2011-06-08 271 {
9f5d71e4a78a02 Zhangfei Gao 2011-06-08 272 struct sdhci_pltfm_host *pltfm_host;
c12d647b0229f4 Arnd Bergmann 2026-08-07 273 struct sdhci_pxa_platdata *pdata;
f35ca223882aa6 Doug Brown 2023-01-16 274 struct sdhci_pxav2_host *pxav2_host;
9f5d71e4a78a02 Zhangfei Gao 2011-06-08 275 struct device *dev = &pdev->dev;
9f5d71e4a78a02 Zhangfei Gao 2011-06-08 276 struct sdhci_host *host = NULL;
dfe9746aed2d12 Doug Brown 2023-01-16 277 const struct sdhci_pxa_variant *variant;
b650352dd3df36 Chris Ball 2012-04-10 278
e41c48b4bcb3ce Doug Brown 2023-01-16 279 struct clk *clk, *clk_core;
9f5d71e4a78a02 Zhangfei Gao 2011-06-08 280
f35ca223882aa6 Doug Brown 2023-01-16 281 host = sdhci_pltfm_init(pdev, NULL, sizeof(*pxav2_host));
6a686c31324c9e Sebastian Hesselbarth 2014-10-21 282 if (IS_ERR(host))
9f5d71e4a78a02 Zhangfei Gao 2011-06-08 283 return PTR_ERR(host);
6a686c31324c9e Sebastian Hesselbarth 2014-10-21 284
9f5d71e4a78a02 Zhangfei Gao 2011-06-08 285 pltfm_host = sdhci_priv(host);
f35ca223882aa6 Doug Brown 2023-01-16 286 pxav2_host = sdhci_pltfm_priv(pltfm_host);
9f5d71e4a78a02 Zhangfei Gao 2011-06-08 287
c21f1b0dc6418e Adrian Hunter 2023-08-11 288 clk = devm_clk_get_optional_enabled(dev, "io");
c21f1b0dc6418e Adrian Hunter 2023-08-11 289 if (!clk)
c21f1b0dc6418e Adrian Hunter 2023-08-11 290 clk = devm_clk_get_enabled(dev, NULL);
072f5e2c34a95b Binbin Zhou 2025-06-07 291 if (IS_ERR(clk))
072f5e2c34a95b Binbin Zhou 2025-06-07 292 return dev_err_probe(dev, PTR_ERR(clk), "failed to get io clock\n");
9f5d71e4a78a02 Zhangfei Gao 2011-06-08 293 pltfm_host->clk = clk;
9f5d71e4a78a02 Zhangfei Gao 2011-06-08 294
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)
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;
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;
f35ca223882aa6 Doug Brown 2023-01-16 328 pxav2_host->pins_default = pinctrl_lookup_state(pxav2_host->pinctrl,
f35ca223882aa6 Doug Brown 2023-01-16 329 "default");
f35ca223882aa6 Doug Brown 2023-01-16 330 if (IS_ERR(pxav2_host->pins_default))
f35ca223882aa6 Doug Brown 2023-01-16 331 pxav2_host->pins_default = NULL;
f35ca223882aa6 Doug Brown 2023-01-16 332 } else {
f35ca223882aa6 Doug Brown 2023-01-16 333 pxav2_host->pinctrl = NULL;
f35ca223882aa6 Doug Brown 2023-01-16 334 }
f35ca223882aa6 Doug Brown 2023-01-16 335
072f5e2c34a95b Binbin Zhou 2025-06-07 336 return sdhci_add_host(host);
9f5d71e4a78a02 Zhangfei Gao 2011-06-08 337 }
9f5d71e4a78a02 Zhangfei Gao 2011-06-08 338
:::::: The code at line 318 was first introduced by commit
:::::: dfe9746aed2d1267f00b880ae232170d7d9e4202 mmc: sdhci-pxav2: add initial support for PXA168 V1 controller
:::::: TO: Doug Brown <doug@schmorgal.com>
:::::: CC: Ulf Hansson <ulf.hansson@linaro.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 5+ messages in thread
* [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
0 siblings, 0 replies; 5+ 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] 5+ 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 ` Dan Carpenter
(?)
@ 2026-08-19 11:02 ` Arnd Bergmann
2026-08-19 11:07 ` Dan Carpenter
-1 siblings, 1 reply; 5+ 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] 5+ 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; 5+ 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] 5+ 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; 5+ 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] 5+ messages in thread
end of thread, other threads:[~2026-08-19 11:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19 6:42 [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) kernel test robot
2026-08-19 7:54 ` 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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.