mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiale Yao <yaojiale02@163.com>
To: Lee Jones <lee@kernel.org>, Rob Herring <robh@kernel.org>,
	mfd@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: Jiale Yao <yaojiale02@163.com>
Subject: [PATCH] mfd: mc13xxx-spi: Reject devices without match data
Date: Fri, 25 Sep 2026 21:37:51 +0800	[thread overview]
Message-ID: <20260925133751.2230782-1-yaojiale02@163.com> (raw)

A device bound through driver_override need not match an entry in the
driver tables. In that case spi_get_device_match_data() returns NULL,
but mc13xxx_common_init() later uses the missing variant data.

Reject devices without match data before entering the common probe path.

Fixes: 15d71e678ec1 ("mfd: mc13xxx-spi/wm831x-spi: Use spi_get_device_match_data()")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
 drivers/mfd/mc13xxx-spi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 56d2e57b7d73..d1523321152a 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -150,6 +150,8 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
 	}
 
 	mc13xxx->variant = spi_get_device_match_data(spi);
+	if (!mc13xxx->variant)
+		return -ENODATA;
 
 	return mc13xxx_common_init(&spi->dev);
 }
-- 
2.34.1


             reply	other threads:[~2026-09-25 13:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 13:37 Jiale Yao [this message]
2026-10-15 11:32 ` Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260925133751.2230782-1-yaojiale02@163.com \
    --to=yaojiale02@163.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®