Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp727243imm; Thu, 13 Sep 2018 06:54:57 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY+7MblRuXnQ2fwnp9Rkjwds5cP4q+DWjpLwDhcWvHrLywBOZTAhHJQpQKchktK7kARWyl2 X-Received: by 2002:a62:7885:: with SMTP id t127-v6mr7662568pfc.6.1536846897184; Thu, 13 Sep 2018 06:54:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536846897; cv=none; d=google.com; s=arc-20160816; b=nA0EnMDWZ+O6Tv4YsEWVckPX4lRAPrd9LOi2LD/A3Ui91vR17jrbelKfY4Iq6r9OKN AYxufiw0y6R+ZzjWSehmHz7nb8MqIgnKZr27iZM3Klu3Mni7wBNm8j2igXNipuduZXKj 3b6Z53mBRYrwWgzlr/V9X0xrsISOo7bKxoKHp64H2h2lm0WHKmAnT6CdwhtSX2sXJP+Z LKXKjI0tB5gHNVkcA1PF/upnzg6RuY0qSzDgcegbTqjsNWlkUi4kzsEFIFN1xcJ5nD83 j/u3NO78BtuSw9qSD94HZj6CgKtY2FhHSmioRRGyo3ES9lz789byYtIYUlq+lYaKUPih 7pgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=if4Uoziobvb6WTXp7Q7LDAQ6bRppS5XpNSnn2YJFYxA=; b=zwKmXVLaKCakOfuli4KUqn4rVNQ62iymShSq3R1BwiuaaMCHW+FldwBO2WV2Rf1+AU RjLy4dg1JVBlZigD/7FQHL6EbByMQhT/2sVCboJgTJGBHbqINpxb5UerN5Q1WDD2a4OX sQfel2vkeftq1QrDDYcu/jOeUv//TYpYZvW9bzpMBb839/UQB3m2xpPqeDFPmA5FYdLE N/W7upJcM/DkjkMcIYsRaZzzRaz9mdQG0jYnftOEPk3LxHfDuoxuZvYuJo2lonpf0aQw kZuM4hinyXxVS2FTYR5hysVbLVNQjv7PhT6kAQheNSDP0thFV4ip7wsBHSdAME9WSNZX YEJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v190-v6si4250911pgd.128.2018.09.13.06.54.41; Thu, 13 Sep 2018 06:54:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731180AbeIMTEM (ORCPT + 99 others); Thu, 13 Sep 2018 15:04:12 -0400 Received: from mga03.intel.com ([134.134.136.65]:6893 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728699AbeIMTEM (ORCPT ); Thu, 13 Sep 2018 15:04:12 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Sep 2018 06:54:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,369,1531810800"; d="scan'208";a="69710185" Received: from chenyu-desktop.sh.intel.com (HELO chenyu-desktop) ([10.239.160.116]) by fmsmga007.fm.intel.com with ESMTP; 13 Sep 2018 06:54:16 -0700 Date: Thu, 13 Sep 2018 22:00:57 +0800 From: Yu Chen To: Thomas Gleixner Cc: "Rafael J. Wysocki" , Pavel Machek , Rui Zhang , Chen Yu , Zhimin Gu , Len Brown , linux-kernel@vger.kernel.org, x86@kernel.org, linux-pm@vger.kernel.org Subject: Re: [PATCH 2/4][v2] PM / hibernate: Check the success of generating md5 digest before hibernation Message-ID: <20180913140057.GB8155@chenyu-desktop> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Thomas, On Thu, Sep 13, 2018 at 10:26:39AM +0200, Thomas Gleixner wrote: > On Wed, 12 Sep 2018, Chen Yu wrote: > > static bool hibernation_e820_mismatch(void *buf) > > @@ -306,6 +307,7 @@ static bool hibernation_e820_mismatch(void *buf) > > int arch_hibernation_header_save(void *addr, unsigned int max_size) > > { > > struct restore_data_record *rdr = addr; > > + int ret = -EINVAL; > > What's the point of initializing ret? > > > if (max_size < sizeof(struct restore_data_record)) > > return -EOVERFLOW; > > @@ -333,7 +335,9 @@ int arch_hibernation_header_save(void *addr, unsigned int max_size) > > > > rdr->magic = RESTORE_MAGIC; > > > > - hibernation_e820_save(rdr->e820_digest); > > + ret = hibernation_e820_save(rdr->e820_digest); > > + if (ret) > > + return ret; > > > > return 0; > > And what;s the point of ret at all? > > return hibernation_e820_save(); > > is effectivly the same. > ret is useless, will change to 'return hibernation_e820_save()' here. Thanks, Yu > Thanks, > > tglx