Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756030AbbKCUPB (ORCPT ); Tue, 3 Nov 2015 15:15:01 -0500 Received: from mail.skyhub.de ([78.46.96.112]:33106 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752725AbbKCUO7 (ORCPT ); Tue, 3 Nov 2015 15:14:59 -0500 Date: Tue, 3 Nov 2015 21:14:55 +0100 From: Borislav Petkov To: "Kweh, Hock Leong" Cc: Matt Fleming , Greg Kroah-Hartman , "Ong, Boon Leong" , LKML , "linux-efi@vger.kernel.org" , Sam Protsenko , Peter Jones , Andy Lutomirski , Roy Franz , James Bottomley , Linux FS Devel , "Fleming, Matt" , "Anvin, H Peter" Subject: Re: [PATCH v9 1/1] efi: a misc char interface for user to update efi firmware Message-ID: <20151103201455.GD3620@pd.tnic> References: <1446055138-26047-1-git-send-email-hock.leong.kweh@intel.com> <1446055138-26047-2-git-send-email-hock.leong.kweh@intel.com> <20151101102944.GA12711@pd.tnic> <20151101105801.GB12711@pd.tnic> <20151101125835.GC12711@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1093 Lines: 27 On Mon, Nov 02, 2015 at 07:17:28AM +0000, Kweh, Hock Leong wrote: > This is not a return value to indicate what is going now. It is a flag > used in "cap_info->index" which positive value has a meaning of index > number. I am using the negative value for the flag which similar to > the implementation of pointer & error pointer (ERR_PTR). Ok, but that doesn't make any sense: you're assigning UPLOAD_DONE to cap_info->index only once in efi_capsule_submit_update() and you're not testing it anywhere. Yeah, yeah, you're implicitly testing for it by doing the "< 0" check. So simply assign -1 to ->index to mean *any* type of error occurred, remove the defines and you can always test for "< 0" to mean "did something fail". You simply don't need two error values... -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/