From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965572AbdLRRWB (ORCPT ); Mon, 18 Dec 2017 12:22:01 -0500 Received: from smtprelay0130.hostedemail.com ([216.40.44.130]:45733 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935262AbdLRRV4 (ORCPT ); Mon, 18 Dec 2017 12:21:56 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::,RULES_HIT:41:69:355:379:541:599:800:960:967:973:988:989:1042:1260:1277:1311:1313:1314:1345:1359:1373:1431:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2525:2561:2564:2682:2685:2828:2859:2899:2902:2911:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3873:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4425:5007:6691:7514:7576:7903:7974:8603:8660:8957:9025:10004:10400:10848:11026:11658:11914:12043:12114:12266:12438:12555:12663:12679:12740:12760:12895:12986:13148:13161:13229:13230:13255:13439:14093:14097:14181:14659:14721:21080:21451:21627:30012:30046:30054:30064:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: song08_67c2ec27e6452 X-Filterd-Recvd-Size: 3309 Message-ID: <1513617711.31581.104.camel@perches.com> Subject: Re: [PATCH 4.9 124/177] platform/x86: sony-laptop: Fix error handling in sony_nc_setup_rfkill() From: Joe Perches To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Andy Shevchenko , Markus Elfring , Andy Shevchenko , Sasha Levin Date: Mon, 18 Dec 2017 09:21:51 -0800 In-Reply-To: <20171218152916.423111963@linuxfoundation.org> References: <20171218152909.823644066@linuxfoundation.org> <20171218152916.423111963@linuxfoundation.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2017-12-18 at 16:49 +0100, Greg Kroah-Hartman wrote: > 4.9-stable review patch. If anyone has any objections, please let me know. I am _very_ suspicious of any -stable patch by Markus Elfring. Are you sure this is necessary and useful for -stable? Does this actually fix something or does it merely reduce object size a few bytes? > ------------------ From: Markus Elfring [ Upstream commit f6c8a317ab208aee223776327c06f23342492d54 ] Source code review for a specific software refactoring showed the need for another correction because the error code "-1" was returned so far if a call of the function "sony_call_snc_handle" failed here. Thus assign the return value from these two function calls also to the variable "err" and provide it in case of a failure. Fixes: d6f15ed876b83a1a0eba1d0473eef58acc95444a ("sony-laptop: use soft rfkill status stored in hw") Suggested-by: Andy Shevchenko Link:https://lkml.org/lkml/2017/10/31/463 Link: https://lkml.kernel.org/r/; Signed-off-by: Markus Elfring Signed-off-by: Andy Shevchenko Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/platform/x86/sony-laptop.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c @@ -1660,17 +1660,19 @@ static int sony_nc_setup_rfkill(struct a if (!rfk) return -ENOMEM; - if (sony_call_snc_handle(sony_rfkill_handle, 0x200, &result) < 0) { + err = sony_call_snc_handle(sony_rfkill_handle, 0x200, &result); + if (err < 0) { rfkill_destroy(rfk); - return -1; + return err; } hwblock = !(result & 0x1); - if (sony_call_snc_handle(sony_rfkill_handle, - sony_rfkill_address[nc_type], - &result) < 0) { + err = sony_call_snc_handle(sony_rfkill_handle, + sony_rfkill_address[nc_type], + &result); + if (err < 0) { rfkill_destroy(rfk); - return -1; + return err; } swblock = !(result & 0x2);