From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEDAC47DF8B for ; Fri, 15 May 2026 11:46:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778845597; cv=none; b=CPA0PyEck3BDSLlYIxUcmc+ijbM7onQ/zBDxDguNEjneHAjWBeyf81z05Ic7TH3J7LAwCH3QB0IH49HGPgs/RPyRIG+JqUu1wL45oIWjT2b21zisY06WljHNGB0+aZbqm9OrdBqG3aNpyMH2jgkZTDAw7/65YtUSu+oOpaHado8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778845597; c=relaxed/simple; bh=rXcxeP+bF7y/WFoLm7I0EmkUZbCTgNBgcu6K29I6YeI=; h=Subject:To:From:Date:Message-ID:MIME-Version:Content-Type; b=a1K7PfRJ6rCVUGJ+ZtZ3HZVD6ra+9bHTpJU4Ds+9Lgr/6WD/0Kcra2UExGLywYxG+afi0sjaCM3gRdBj1Evlu9nXkKQZdRc6WxRcI/vu+oExbmuYzwUT6UGxh2CZ6eYqFiFgtsbD2QCcoq2yA0x0hXY+kXwkzY44WGqcESjbCOI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=p7o46kye; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="p7o46kye" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6417DC2BCB7; Fri, 15 May 2026 11:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778845597; bh=rXcxeP+bF7y/WFoLm7I0EmkUZbCTgNBgcu6K29I6YeI=; h=Subject:To:From:Date:From; b=p7o46kye3wRNTUc0Lf8Drkk0g+JsO86RKpXTKuUB5L11kZ0LBrHgOSJahFboakFD1 QDBQo8qpA+G+Y3/FTvY+nsuCDvTOu5GCcrMDT+okBElz9q5IZNasYs4TzkF0rj/0Ph zO+9RkSvnGSJx/cV/xk/7T7ca+KPoIHLMK6Xo2B4= Subject: patch "iio: dac: max5821: fix return value check in powerdown sync" added to char-misc-linus To: salah.triki@gmail.com,Stable@vger.kernel.org,andriy.shevchenko@intel.com,jic23@kernel.org From: Date: Fri, 15 May 2026 13:45:59 +0200 Message-ID: <2026051559-paver-cinema-ed1a@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit This is a note to let you know that I've just added the patch titled iio: dac: max5821: fix return value check in powerdown sync to my char-misc git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git in the char-misc-linus branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will hopefully also be merged in Linus's tree for the next -rc kernel release. If you have any questions about this process, please let me know. >From d0a228d903425e653f18a4341e60c0538afb6d41 Mon Sep 17 00:00:00 2001 From: Salah Triki Date: Mon, 27 Apr 2026 22:33:19 +0100 Subject: iio: dac: max5821: fix return value check in powerdown sync The function max5821_sync_powerdown_mode() returned the result of i2c_master_send() directly. If a partial transfer occurred, it would be incorrectly treated as a success by the caller. While the caller currently handles the positive return value of 2 as success, this patch refactors the function to return 0 on full success and -EIO on short writes. This ensures robust error handling for incomplete transfers and improves code maintainability by using sizeof(outbuf). Fixes: 472988972737 ("iio: add support of the max5821") Signed-off-by: Salah Triki Reviewed-by: Andy Shevchenko Cc: Signed-off-by: Jonathan Cameron --- drivers/iio/dac/max5821.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/iio/dac/max5821.c b/drivers/iio/dac/max5821.c index e7e29359f8fe..dd4e35460195 100644 --- a/drivers/iio/dac/max5821.c +++ b/drivers/iio/dac/max5821.c @@ -90,6 +90,7 @@ static int max5821_sync_powerdown_mode(struct max5821_data *data, const struct iio_chan_spec *chan) { u8 outbuf[2]; + int ret; outbuf[0] = MAX5821_EXTENDED_COMMAND_MODE; @@ -103,7 +104,13 @@ static int max5821_sync_powerdown_mode(struct max5821_data *data, else outbuf[1] |= MAX5821_EXTENDED_POWER_UP; - return i2c_master_send(data->client, outbuf, 2); + ret = i2c_master_send(data->client, outbuf, sizeof(outbuf)); + if (ret < 0) + return ret; + if (ret != sizeof(outbuf)) + return -EIO; + + return 0; } static ssize_t max5821_write_dac_powerdown(struct iio_dev *indio_dev, -- 2.54.0