Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4238111rdb; Mon, 11 Dec 2023 12:59:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IEINHUvb0ZwPlfM4MRSvMguUWhweJtf6NIDSJBuzhEFgi1+GSj14Gohw5Dm05viHOfqLSB/ X-Received: by 2002:a17:903:41c6:b0:1d0:5878:d4e6 with SMTP id u6-20020a17090341c600b001d05878d4e6mr6817982ple.4.1702328360394; Mon, 11 Dec 2023 12:59:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702328360; cv=none; d=google.com; s=arc-20160816; b=cKxoWX8CvGc6gkINFnrj672sHt5wzAhGq/wLXU2B9QZDf5nA8GiASgCJ3GCxHEgqM2 a+P0yT4WqUa9LVF8Pdjv1u6a6Odi0bk2r51K93mcwolj6rYhavv0//ZCZrE+TzNJ2GDH 5YXW1E8WBGZaRDAedwQy4ZosQjm5ufD08a2FDDGu2KTg8B/sCTKZDptbHGPGA98cgFZl 5+OU42hkSXntHJrA2sCe4/MFhBnZClkKx6SuGpSetu74iCwEMcgNhuQ3ctwRC7nd7iHw qtKl3rX4nlZERgNa85PmkEhmxLGVg2/Ak5WXE6xUkpKtH+jeWSOtCfonJTZ2npnNbJwS ZxdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=OztpUC0e/xmBRbxais9az9RGawd1oNJaKoz/g8XN0sk=; fh=xMpdKBYwzf4gOXCHV6kD76LTa+JCYOHVJD41eWguzMU=; b=L6ka2E0vTwY5S1vadVaWCsT3KvMRQP4F6OGmzTaFj3fwop3N+66vC7Hdy7ED02C6mt /cm2OIDAczS42VI+7V8AVQg5UtZAkOUDcUz+S1KC0CJn4VKg5IzmiqZ28gQ8u700Ntvh OowIPrfd2FJC3wT+1HtvkPZX62EdySRtiNR7dCjAtQYmaeCb2WOAv5iZmhIMbHl9wNc+ bcUqc6xcjkxkWWMQ9mJrdSV8L6Fo4Hgv2o91MovjF9IOGuupfnBT0/dY4mD3vHbHp/xD KySj6fOFr6ftSneFOehmMi7a3cptFcQqJ0VQPYG98HGcbQLXXv+DYbmWa6YQ5HNAQyWE Q6vw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id e21-20020a170902d39500b001d0c55bc556si6533480pld.35.2023.12.11.12.59.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 12:59:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3A4D38058B45; Mon, 11 Dec 2023 12:59:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344942AbjLKU6u convert rfc822-to-8bit (ORCPT + 99 others); Mon, 11 Dec 2023 15:58:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344858AbjLKU6t (ORCPT ); Mon, 11 Dec 2023 15:58:49 -0500 Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BD64CB; Mon, 11 Dec 2023 12:58:55 -0800 (PST) Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-5909156aea9so501645eaf.0; Mon, 11 Dec 2023 12:58:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702328334; x=1702933134; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z6ByGiT9WFMUFMKy+HhAkr+u0X6bTiLvBm2bjTbo8WQ=; b=SfwocifkhiF+7XM0LFMmxnlKaZtO8vJPxYj/2Y58gooYiBkZXOdPLB1zIm0aByYEcr BtJZyuu8ltHc/DlGsJlBZ8FFnxOnysRxA/U5c9/2Y6BDekWr7s7o7fvaPGNAjanvu8ov oJ7vAOMiLpQlfXQEE7M34ByUKxdBh8rv1aoXGCA+lpweeN5iOT0MC0c6fQ6tld2/UTPc ksc7LvB7QAg5oTITOFEqZqkbol37QGipBwLKCDDhbubiyHcvjkM8v+YTZr5DLB0w+3Tm 2qW5lagLEMyIu+UKpnQxu6VeYJsvQ/33nqBmPwmgqN2gU/Y9S2q2JEG6jeSN2+yueEqz C3cA== X-Gm-Message-State: AOJu0YzTa4jM5R0e3wjcJrobPbWJc2d/YharfkawA5uIJ9qsH3H1POZB /48i3HeeGoIMDRDWTAaicwxZWfzikAnPhPXFO3Q= X-Received: by 2002:a4a:da02:0:b0:590:7b43:47e4 with SMTP id e2-20020a4ada02000000b005907b4347e4mr8624200oou.1.1702328334790; Mon, 11 Dec 2023 12:58:54 -0800 (PST) MIME-Version: 1.0 References: <20231020083743.11412-1-zhoujie@nfschina.com> In-Reply-To: <20231020083743.11412-1-zhoujie@nfschina.com> From: "Rafael J. Wysocki" Date: Mon, 11 Dec 2023 21:58:44 +0100 Message-ID: Subject: =?UTF-8?Q?Re=3A_=5BPATCH=5D_power=3A_main=3A_Remove_unnecessary_=E2=80=98NULL?= =?UTF-8?Q?=E2=80=99_initialization_from_last=5Ffailed=5Fstep=5Fshow=28=29?= To: ZhouJie Cc: rafael@kernel.org, pavel@ucw.cz, len.brown@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Mon, 11 Dec 2023 12:59:18 -0800 (PST) On Fri, Oct 20, 2023 at 10:38 AM ZhouJie wrote: > > 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. Did you want to say something like "it is not necessary to initialize last_failed_step to NULL, because it is never read before being assigned a value" ? Also, to my eyes, last_failed_step is redundant and can be dropped from that function entirely. > 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; > -- > 2.18.2 >