mtd: nand: pxa3xx: Null de-references with dev_err()

Sean Anderson seanga2 at gmail.com
Thu Dec 18 05:49:35 CET 2025


On 12/17/25 21:21, Chris Packham wrote:
> Hi All,
> 
> Sorry this isn't a patch but I've just stumbled across a problem and
> I'm not sure how to deal with it.
> 
> In commit 661c98121d49 ("mtd: nand: pxa3xx: Fix not calling dev_xxx
> with a device") Sean updated some code to pass a valid device to
> dev_err(). Most of the places had a struct mtd_info * with an
> appropriate member. A few didn't and Sean used
> info->controller.active->mtd.dev instead but it looks like
> controller.active is only assigned via panic_nand_get_device() which
> I'm not sure is ever actually called in u-boot. Being that the
> offending calls are only in error cases I'm guessing no-one else has
> stumbled across them.
> 
> I'm a little unsure what to do here. Some of the uses of
> info->controller.active->mtd.dev are close enough to a struct mtd_info
> * that I can just pass that in. But others are buried deep and it
> would be quite invasive to add. I could add a dev member to struct
> pxa3xx_nand_info. Or just change the dev_err to pr_err instead.
> 
> Any preference?

I'd just add a dev member to nand_info.

--Sean


More information about the U-Boot mailing list