From patchwork Fri Oct 20 08:37:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ZhouJie X-Patchwork-Id: 13430260 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9DC4CDB47E for ; Fri, 20 Oct 2023 08:37:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376433AbjJTIh7 (ORCPT ); Fri, 20 Oct 2023 04:37:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376486AbjJTIh6 (ORCPT ); Fri, 20 Oct 2023 04:37:58 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 13F0BD53; Fri, 20 Oct 2023 01:37:55 -0700 (PDT) Received: from localhost.localdomain (unknown [219.141.250.2]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id 9B143604652C0; Fri, 20 Oct 2023 16:37:50 +0800 (CST) X-MD-Sfrom: zhoujie@nfschina.com X-MD-SrcIP: 219.141.250.2 From: ZhouJie To: rafael@kernel.org, pavel@ucw.cz, len.brown@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, ZhouJie Subject: [PATCH] =?utf-8?q?power=3A_main=3A_Remove_unnecessary_=E2=80=98NULL?= =?utf-8?q?=E2=80=99_initialization_from_last=5Ffailed=5Fstep=5Fshow=28=29?= Date: Fri, 20 Oct 2023 16:37:43 +0800 Message-Id: <20231020083743.11412-1-zhoujie@nfschina.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Declaring char *last_failed_step; is reasonable because you can later assign the function's return value to last_failed_step without explicitly assigning an initial value. Signed-off-by: ZhouJie --- kernel/power/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/power/main.c b/kernel/power/main.c index f6425ae3e8b05..24c675f6ab862 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -410,7 +410,7 @@ static ssize_t last_failed_step_show(struct kobject *kobj, { int index; enum suspend_stat_step step; - char *last_failed_step = NULL; + char *last_failed_step; index = suspend_stats.last_failed_step + REC_FAILED_NUM - 1; index %= REC_FAILED_NUM;