]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iioc: dac: ltc2664: Fix span variable usage in ltc2664_channel_config()
authorMohammed Anees <pvmohammedanees2003@gmail.com>
Sat, 5 Oct 2024 20:04:35 +0000 (01:34 +0530)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 6 Oct 2024 15:31:46 +0000 (16:31 +0100)
commitccf9af8b0dadd0aecc24503ef289cbc178208418
treedac34e2a3ba4b09a35c79860d10d74107da0751d
parent27b6aa68a68105086aef9f0cb541cd688e5edea8
iioc: dac: ltc2664: Fix span variable usage in ltc2664_channel_config()

In the current implementation of the ltc2664_channel_config() function,
a variable named span is declared and initialized to 0, intended to
capture the return value of the ltc2664_set_span() function. However,
the output of ltc2664_set_span() is directly assigned to chan->span,
leaving span unchanged. As a result, when the function later checks
if (span < 0), this condition will never trigger an error since
span remains 0, this flaw leads to ineffective error handling. Resolve
this issue by using the ret variable to get the return value and later
assign it if successful and remove unused span variable.

Fixes: 4cc2fc445d2e ("iio: dac: ltc2664: Add driver for LTC2664 and LTC2672")
Signed-off-by: Mohammed Anees <pvmohammedanees2003@gmail.com>
Link: https://patch.msgid.link/20241005200435.25061-1-pvmohammedanees2003@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/dac/ltc2664.c