From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B03B9385D66 for ; Fri, 31 Jul 2026 07:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785482046; cv=none; b=f903pAANq2hwazimPYQvdlA5oDwiHWS85EAY8T8U9azp1g93NqR2jNdbCav5wVwHewUo8TEDIJHPKMmILrJO2LSON9PMK1E8I6HvZHr5gYTmU3tI9G2X14F8vbupdV1y6hOr3ZtMYdz3T62yvfZH/4+XqLg/ce/tMDsCbKIMSqw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785482046; c=relaxed/simple; bh=qyPl2oBD5Fe6wRHu9d0Fm6WFEkui9o/S0SOLNMw13Jk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lNogPSFOtzs2kl7bf4vLt9vY9O733K2F3ENS9fcFkSa8Fx4NgI1MODa4s2oBh6aQGlRm2J69RIDKopsQaZRdIOtFSUF+L/5bc3O7C+XHQFM4sevQ6ih23QNF2Mx9qL46zyPiN0f3MB9qI+od+yTTf0CQOQ+d1xftp980/Xt6128= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=K/e18wrj; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="K/e18wrj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 660961F00A3A; Fri, 31 Jul 2026 07:14:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785482045; bh=bE2YKvVX+zCYpjyOTaeVPiDRBdBtvdo/N1hEJw6cSQs=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=K/e18wrjfzgNsB7CWurkDCE6CZOfcZFC7vJ9RLDO8rj8u5Nb5aCJ5rhTmJcin0ex/ bZolPa1VHE9sbMXL144UpNB+K62ecjEXL/7hy65IbtLGn9NmRY+m2nsPU6uzKmN/oX z4KkApSrlVMKcgcGsnl7d6+4P7/yOdHFKivD/2tikLvkzhIrwbO/RkV5xxntd4xTWa cABhXXh8gvookV6IrD6mch0NC9s+a8nc4uGSTxw97M8M35ImfmfrQ2e14QThczgR14 70lcYIgrxfbPjQlxAmouIuCf2oBL4z7lwIjr42yJ37G6n71iC3i5+snASiIADc7L3l Wq8y8oIZog81w== Message-ID: <2c505334-a744-499f-88f5-d2c779f69f0f@kernel.org> Date: Fri, 31 Jul 2026 09:14:01 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] powerpc/powernv: Avoid strlen() in pnv_restart() To: Thorsten Blum , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Aboorva Devarajan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20260721155346.121975-3-thorsten.blum@linux.dev> Content-Language: fr-FR From: "Christophe Leroy (CS GROUP)" In-Reply-To: <20260721155346.121975-3-thorsten.blum@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 21/07/2026 à 17:53, Thorsten Blum a écrit : > Check only the first byte instead of scanning the entire string with > strlen(). Well, strlen() is not going to scan the entire string, it will break at first 0. But I agreed calling strlen() is not worth it. > > Signed-off-by: Thorsten Blum Reviewed-by: Christophe Leroy (CS GROUP) > --- > arch/powerpc/platforms/powernv/setup.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c > index 06ed5e2aa265..2af92e7ba4ee 100644 > --- a/arch/powerpc/platforms/powernv/setup.c > +++ b/arch/powerpc/platforms/powernv/setup.c > @@ -312,7 +312,7 @@ static void __noreturn pnv_restart(char *cmd) > pnv_prepare_going_down(); > > do { > - if (!cmd || !strlen(cmd)) > + if (!cmd || *cmd == '\0') Maybe !*cmd instead ? > rc = opal_cec_reboot(); > else if (strcmp(cmd, "full") == 0) > rc = opal_cec_reboot2(OPAL_REBOOT_FULL_IPL, NULL);