Devicetree
 help / color / mirror / Atom feed
From: Jishnu Prakash <jishnu.prakash@oss.qualcomm.com>
To: sashiko-reviews@lists.linux.dev
Cc: mfd@lists.linux.dev, devicetree@vger.kernel.org, robh@kernel.org,
	conor+dt@kernel.org, lee@kernel.org
Subject: Re: [PATCH v2 5/7] mfd: qcom-pm8008: Add PM8010 support
Date: Mon, 19 Oct 2026 10:30:54 +0530	[thread overview]
Message-ID: <e4c681f1-b516-4a0a-8ddd-4885e428e748@oss.qualcomm.com> (raw)
In-Reply-To: <sashiko-outbox-171155@kernel.org>

On 10/14/2026 4:14 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] mfd: silent fallback to PM8008 on non-DT PM8010 instances
> --
> 
> commit 4e77301709b8663667033b7dfed82cf937a2d7c5
> Author: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> 
> mfd: qcom-pm8008: Add PM8010 support
> 
> This commit adds support for the PM8010 to the qcom-pm8008 driver. It
> incorporates PM8010 specific IRQs, MFD cells, and match data to support the
> new device type via I2C.
> 
>> diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c
>> index 2d6c01cf54f32..4179427f38911 100644
>> --- a/drivers/mfd/qcom-pm8008.c
>> +++ b/drivers/mfd/qcom-pm8008.c
> [ ... ]
>> @@ -180,14 +218,36 @@ static void devm_irq_domain_fwnode_release(void *data)
>>  static int pm8008_probe(struct i2c_client *client)
>>  {
>>  	struct regmap_irq_chip_data *irq_data;
>> +	const struct regmap_irq_chip *irq_chip_desc;
>>  	struct device *dev = &client->dev;
>> +	const struct mfd_cell *mfd_cells;
>>  	struct regmap *regmap, *regmap2;
>>  	struct fwnode_handle *fwnode;
>>  	struct i2c_client *dummy;
>>  	struct gpio_desc *reset;
>> +	unsigned long pmic_type;
>> +	int num_mfd_cells;
>>  	char *name;
>>  	int ret;
>>  
>> +	pmic_type = (unsigned long)of_device_get_match_data(dev);
> 
> [Severity: Medium]
> Will this silently fall back to TYPE_PM8008 for non-DT devices?
> 
> of_device_get_match_data() explicitly checks for dev->of_node and returns
> NULL when it isn't present (such as devices instantiated via ACPI PRP0001
> or swnodes). A NULL return evaluates to 0, which matches TYPE_PM8008 in
> the switch below.
> 
> This means a valid qcom,pm8010-i2c device instantiated via ACPI or swnodes
> will be misidentified as TYPE_PM8008 instead of TYPE_PM8010.
> 
> Could this use i2c_get_match_data() or device_get_match_data() to ensure
> device variants are correctly extracted regardless of the underlying
> firmware representation?

This driver is intended to support DT-only instantiation right now, so
we don't expect to have instantiations via ACPI or swnodes.

But anyway, to avoid the ambiguity due to NULL return from
of_device_get_match_data evaluating to 0, I can add an explicit
check for its return value and fail probe with an error if it
ever returns NULL.

Thanks,
Jishnu


> 
>> +
>> +	switch (pmic_type) {
>> +	case TYPE_PM8008:
>> +		irq_chip_desc = &pm8008_irq_chip;
>> +		mfd_cells = pm8008_cells;
>> +		num_mfd_cells = ARRAY_SIZE(pm8008_cells);
>> +		break;
> 


  reply	other threads:[~2026-10-19  5:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 10:31 [PATCH v2 0/7] mfd: qcom-pm8008: Add support for PM8010 over I2C Jishnu Prakash
2026-10-14 10:31 ` [PATCH v2 1/7] dt-bindings: mfd: pm8008: Add qcom,pm8010-i2c compatible Jishnu Prakash
2026-10-19  7:44   ` Guru Das Srinagesh
2026-10-14 10:31 ` [PATCH v2 2/7] regulator: pm8008: Add PM8010 support Jishnu Prakash
2026-10-14 10:32 ` [PATCH v2 3/7] regulator: qcom-pm8008: Add PM8010 mode support Jishnu Prakash
2026-10-14 10:45   ` sashiko-bot
2026-10-19  5:00     ` Jishnu Prakash
2026-10-19  7:31   ` Guru Das Srinagesh
2026-10-22  8:42     ` Jishnu Prakash
2026-10-19  7:41   ` Guru Das Srinagesh
2026-10-22  8:42     ` Jishnu Prakash
2026-10-14 10:32 ` [PATCH v2 4/7] mfd: qcom-pm8008: Drop GPIO support Jishnu Prakash
2026-10-14 10:45   ` sashiko-bot
2026-10-15 12:01   ` Konrad Dybcio
2026-10-14 10:32 ` [PATCH v2 5/7] mfd: qcom-pm8008: Add PM8010 support Jishnu Prakash
2026-10-14 10:44   ` sashiko-bot
2026-10-19  5:00     ` Jishnu Prakash [this message]
2026-10-15 12:04   ` Konrad Dybcio
2026-10-19  5:00     ` Jishnu Prakash
2026-10-14 10:32 ` [PATCH v2 6/7] dt-bindings: mfd: pm8008: Make interrupts optional Jishnu Prakash
2026-10-14 10:32 ` [PATCH v2 7/7] mfd: qcom-pm8008: Tolerate missing interrupt Jishnu Prakash
2026-10-15 11:00   ` Nihal Kumar Gupta
2026-10-15 12:05   ` Konrad Dybcio
2026-10-19  5:01     ` Jishnu Prakash

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=e4c681f1-b516-4a0a-8ddd-4885e428e748@oss.qualcomm.com \
    --to=jishnu.prakash@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee@kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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