On 3/27/2026 2:04 AM, Andy Shevchenko wrote:
On Thu, Mar 26, 2026 at 12:00:52PM +0000, Antony Kurniawan Soemardi wrote:
On 3/26/2026 5:18 PM, Andy Shevchenko wrote:
...
+       if (!ch) {
+               dev_err(adc->dev, "no such channel %lu\n", chan->address);
+               return -EINVAL;
+       }

Isn't it a dead code? Also poisoning dmesg with this recurrent message is
not good idea to begin with (the user space will have a door to flood it,
which might be considered as an assistance to hackers to clear immediate
logs after a successful attack).

Good point about the successful attack hint! I was copying the existing
code from pm8xxx_read_raw. Do you think those checks are unnecessary for
pm8xxx_read_raw as well?

Yes, I think they are not as the returned code should be enough to identify
the problem. (For no such channel I would rather see -ENOENT, but we can't
simply replace that in the existing code as it's part of ABI.)

Just to re-clarify, do you mean for both pm8xxx_read_label &
pm8xxx_read_raw:
1. if the check fails, it should only return -EINVAL without any
   logging; or
2. remove the checks because there's no way it's not found?

--
Thanks,
Antony K. S.

Reply via email to