From patchwork Tue Oct 24 02:04:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li zeming X-Patchwork-Id: 157194 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1667236vqx; Mon, 23 Oct 2023 19:05:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFyjWuo29RvOwhyc7HY2tWSS7UfybAv5D4Su/S3yp0fd63dTvREtS6BFoFIw0rPIIScfXfO X-Received: by 2002:a05:6a00:18a6:b0:68f:ce6a:8685 with SMTP id x38-20020a056a0018a600b0068fce6a8685mr14839540pfh.14.1698113111164; Mon, 23 Oct 2023 19:05:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698113111; cv=none; d=google.com; s=arc-20160816; b=JqKGJ7FeobxzKe7P9oQHpw4lKomBsN3cOjBIn3VmsQrGXgJavCpmxc2duKnDoOJQdr YzXq5nVGEX9Bh2G6ztPstu7Nlb/zP9HIEFvSzl3F844/brioxkCY7ktbxIaxX2PmcDHK CasK2tV+DVC2dLw8IeSAJVBgGZ1sdanE9Zl+079LXn8ikMxHPCSxgS07EtEGWCG0Fiuv MSj/j8kc11tmsVlsA5taT2vVoWdUcktAscns5nnw4Ouk+v37DtAiR17GGqjYk6pHiTm0 3O4e+GZWWAwViG2P263gJLGJAoXwMzHfDcOrkN0MWT4maOEhfkMY/yMKBsELX+VGdYya ZU8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=Xtiwg18dtxl7iEItD1lXUU1XSR2GdzaiGRVL53AUZa4=; fh=XXTE+v89T9KQrmZaeCSUCZJMHSpQ1uTFJCHnUJEkf28=; b=zeg8RsEcIqDV/5rM+L63EzOAX19yPM0ZlD6D0DQe2DPkjqc3MgLZn/fMpBv2riYVys GND93AphXCQ+qYpQsJUvgiWnfYe8S9B92VyTqq6SUqDEtOZFUWj/fKmnUOJHfxjgW/63 chJ6kDjt0Fhvu8WOlZuHeMnYWPY6TA1zFI0aqgKaifQkRPAPY3Z+jwrdccRCGFJMPAlK r3Tr1m1idEPD4qZ03h7L9vkeoEHAPApHAx2cFOY/U/xjkusRwbWuSkqtoSnc90WDCi2c VdV6iCQ28NLbp43c0NiNwHLnPx3V62hAKMTKfOh1xgdEzGHVhXH0E96nt4ZFH16XjNsg VKAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id j184-20020a638bc1000000b0054fbd904b6dsi7354994pge.500.2023.10.23.19.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 19:05:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 330B480C5FAE; Mon, 23 Oct 2023 19:05:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231883AbjJXCFG (ORCPT + 27 others); Mon, 23 Oct 2023 22:05:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231916AbjJXCFF (ORCPT ); Mon, 23 Oct 2023 22:05:05 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 43497D7C; Mon, 23 Oct 2023 19:04:59 -0700 (PDT) Received: from localhost.localdomain (unknown [219.141.250.2]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id E66DC602A1AC2; Tue, 24 Oct 2023 10:04:41 +0800 (CST) X-MD-Sfrom: zeming@nfschina.com X-MD-SrcIP: 219.141.250.2 From: Li zeming To: rafael@kernel.org, len.brown@intel.com, pavel@ucw.cz Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Li zeming Subject: [PATCH] power: snapshot: Optimize the error variable in the snapshot_write_next() Date: Tue, 24 Oct 2023 10:04:34 +0800 Message-Id: <20231024020434.34145-1-zeming@nfschina.com> X-Mailer: git-send-email 2.18.2 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RDNS_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 23 Oct 2023 19:05:10 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780600654004758525 X-GMAIL-MSGID: 1780600654004758525 Assign a value when removing the definition for error, which is assigned before use. Signed-off-by: Li zeming --- kernel/power/snapshot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 87e9f7e2bdc05..40c141144c9a1 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -2776,7 +2776,7 @@ static void *get_buffer(struct memory_bitmap *bm, struct chain_allocator *ca) int snapshot_write_next(struct snapshot_handle *handle) { static struct chain_allocator ca; - int error = 0; + int error; next: /* Check if we have already loaded the entire image */