Re: [PATCH] Sony-laptop: Use common error handling code in sony_nc_setup_rfkill()
From: SF Markus Elfring
Date: Tue Oct 31 2017 - 10:24:41 EST
> Apparently this patch done without reading the actual code.
I performed another simple software refactoring.
> NAK.
>
> -1 is EPERM which sounds wrong here. If you would like to fix it,
> propagate a real error codes from sony_call_snc_handle().
I do not know at the moment why an error code which you find
questionable was suggested by Marco Chiappero on 2012-05-19
and committed by Matthew Garrett on 2012-05-31 (according the
commit d6f15ed876b83a1a0eba1d0473eef58acc95444a: use soft rfkill
status stored in hw).
>> if (!rfk)
>> return -ENOMEM;
>
> Okay error code.
Can any other identifier make more sense there?
>> - }
>> + if (sony_call_snc_handle(sony_rfkill_handle, 0x200, &result) < 0)
>> + goto destroy_rfk;
>> +
>> hwblock = !(result & 0x1);
>>
>> if (sony_call_snc_handle(sony_rfkill_handle,
>> - sony_rfkill_address[nc_type],
>> - &result) < 0) {
>> - rfkill_destroy(rfk);
>> - return -1;
>
> Not okay and it might be different from previous case.
The shown function call was repeated with an other parameter.
Which error reporting would you find more appropriate then?
> P.S. Don't bother us with patches on which you didn't do your home work.
Do we occasionally need to distinguish better between an ordinary
refactoring and the adjustments for additional software improvements?
Regards,
Markus