Re: [PATCH] driver core: bus: Return -EIO instead of 0 when show/store invalid bus attribute

From: quic_zijuhu
Date: Wed Jul 24 2024 - 10:18:15 EST


On 7/24/2024 9:29 PM, Greg Kroah-Hartman wrote:
> On Wed, Jul 24, 2024 at 08:56:18PM +0800, quic_zijuhu wrote:
>> On 7/24/2024 1:31 AM, Greg Kroah-Hartman wrote:
>>> On Tue, Jul 23, 2024 at 10:55:43PM +0800, Zijun Hu wrote:
>>>> From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
>>>>
>>>> Return -EIO instead of 0 when show/store invalid bus attribute as
>>>> class/device/driver/kobject attribute.
>>>
>>> Why? What is this now going to break? You are changing a user-visable
>>> api that has been this way for 20+ years, how was this tested?
>>>
>> this change should break nothing.
>
> Have you tested all tools that access these files? Please document what
> was done for testing please.
>
not yet. let me do more investigation then give reply.

sorry to send v2 without noticing this reply.
let us still discuss with this mail thread.

>> tested by wc a writing only bus attribute, for example
>>
>> root@kvm-Q35:/sys/bus/gpio# ls -l
>> --w------- 1 root root 4096 7月 24 20:20 drivers_probe
>> root@kvm-Q35:/sys/bus/gpio# chmod u+r drivers_probe
>> root@kvm-Q35:/sys/bus/gpio# wc -c drivers_probe
>> 0 drivers_probe // for current design
>>
>> root@zijun-kvm-Q35:/sys/bus/gpio# wc -c drivers_probe
>> wc: drivers_probe: Input/output error // for this change
>
> That's just using a shell, I am referring to actual tools that read
> these files and rely on the contents and error values that they provide.
>
make sense.
> thanks,
>
> greg k-h