Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ariana Lazar" <ariana.lazar@microchip.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v4 6/9] iio: dac: mcp47feb02: rename command mask define
Date: Wed, 19 Aug 2026 12:46:22 +0000	[thread overview]
Message-ID: <20260819124623.2BCF61F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260819-mcp47feb02_refactor-v4-6-beb2aa3bfd09@microchip.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Incorrect initialization of the `powerdown` state when the device boots in `1kohm_to_gnd` power-down mode.
--

--- Patch [6]: [PATCH v4 6/9] iio: dac: mcp47feb02: rename command mask define ---
commit 5165e39a3476c86b84b827af722b000649c5b496
Author: Ariana Lazar <ariana.lazar@microchip.com>

iio: dac: mcp47feb02: rename command mask define

This commit replaces a generic mask definition with two new macros,
MCP47FEB02_GET_VREF_MODE and MCP47FEB02_GET_POWER_DOWN_MODE. These
improve code readability when extracting channel configurations.

> diff --git a/drivers/iio/dac/mcp47feb02.c b/drivers/iio/dac/mcp47feb02.c
> index 6f084eb71240b..8ca67c4021a86 100644
> --- a/drivers/iio/dac/mcp47feb02.c
> +++ b/drivers/iio/dac/mcp47feb02.c

[ ... ]

> @@ -1070,7 +1071,7 @@ static int mcp47feb02_init_ctrl_regs(struct mcp47feb02_data *data)
>  			break;
>  		}
>  
> -		pd_tmp = (pd_ch >> (2 * i)) & MCP47FEB02_DAC_CTRL_MASK;
> +		pd_tmp = MCP47FEB02_GET_POWER_DOWN_MODE(pd_ch, i);
>  		data->chdata[i].powerdown_mode = pd_tmp ? (pd_tmp - 1) : pd_tmp;
>  		data->chdata[i].powerdown = !!(data->chdata[i].powerdown_mode);

[Severity: High]
This is a pre-existing issue, but does this logic incorrectly set the channel
to an active state when the device boots in 1kohm_to_gnd power-down mode?

When the device is configured in 1kohm_to_gnd mode in
mcp47feb02_init_ctrl_regs(), pd_tmp evaluates to 1. The preceding line sets
powerdown_mode to 0 (1 - 1 = 0). As a result, the check
!!(data->chdata[i].powerdown_mode) evaluates to false.

Does this cause the driver to report the channel as active, desynchronizing
the software state from the actual hardware state?

>  	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260819-mcp47feb02_refactor-v4-0-beb2aa3bfd09@microchip.com?part=6

  reply	other threads:[~2026-08-19 12:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19 12:41 [PATCH v4 0/9] Refactor Microchip MCP47FEB02 I2C driver in separate modules to add support for MCP48FEB02 SPI driver Ariana Lazar
2026-08-19 12:41 ` [PATCH v4 1/9] iio: dac: mcp47feb02: initialize dac_data field in channel data struct at probe Ariana Lazar
2026-08-19 14:17   ` Andy Shevchenko
2026-08-19 12:41 ` [PATCH v4 2/9] iio: dac: mcp47feb02: correct gain bitshift " Ariana Lazar
2026-08-19 12:50   ` sashiko-bot
2026-08-19 14:15   ` Andy Shevchenko
2026-08-19 12:41 ` [PATCH v4 3/9] iio: dac: mcp47feb02: correct false state case in store_eeprom_store Ariana Lazar
2026-08-19 12:51   ` sashiko-bot
2026-08-19 14:18   ` Andy Shevchenko
2026-08-19 12:41 ` [PATCH v4 4/9] iio: dac: mcp47feb02: use dev_dbg for invalid label Ariana Lazar
2026-08-19 12:49   ` sashiko-bot
2026-08-19 14:23   ` Andy Shevchenko
2026-08-19 12:41 ` [PATCH v4 5/9] iio: dac: mcp47feb02: correct typo from a comment Ariana Lazar
2026-08-19 12:41 ` [PATCH v4 6/9] iio: dac: mcp47feb02: rename command mask define Ariana Lazar
2026-08-19 12:46   ` sashiko-bot [this message]
2026-08-19 12:41 ` [PATCH v4 7/9] iio: dac: mcp47feb02: refactor MCP47FEB02 I2C driver into two modules Ariana Lazar
2026-08-19 12:52   ` sashiko-bot
2026-08-19 12:41 ` [PATCH v4 8/9] dt-bindings: iio: dac: add support for MCP48FEB02 SPI Ariana Lazar
2026-08-19 12:41 ` [PATCH v4 9/9] iio: dac: add support for Microchip MCP48FEB02 Ariana Lazar
2026-08-19 12:53   ` sashiko-bot

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=20260819124623.2BCF61F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ariana.lazar@microchip.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --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