Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2748665lqt; Mon, 22 Apr 2024 23:28:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWh+7jdGl69BLNYFhmCx1sSZsnJSptXTRRX8aMLj/UAgRGySOq4YA5R/b6+8cOC2f2s70JfJMBW5H0QZj6jaN+sK/GIi4aJbrbDEsJ7xQ== X-Google-Smtp-Source: AGHT+IEUi/9TtuL2W9kkVC+oZgDhG+HpAdu1mYok00KYcWC1OaywWZCfQo6j4sZboPqBXPoIi+We X-Received: by 2002:a05:6871:e411:b0:229:8236:ae9 with SMTP id py17-20020a056871e41100b0022982360ae9mr16622407oac.59.1713853722620; Mon, 22 Apr 2024 23:28:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713853722; cv=pass; d=google.com; s=arc-20160816; b=OwWgT//ptB5R9h2PmsZcAJoHODaEAGIh0C+0aD+ELmSsedVRxZhKU+gFnHVzlgxqL8 r33mnj0JVydGm3jAZSHf2I+lKQ2cW+b9bkwdgJpBWopwIvaY6OpLY3y+VSdRst137dyr KpXgMEBg4oJHPVPbFc114rAJ+9xOAwn5AM9e5U4Gi7hn5XV+ZmFF+q8r4Fmq+ZT6PDgz VtzdJaWWLV1KD+dOsfb6E5L1Ke60VjWHQY+jWpRjQxe2yjcQ0cIL+/FYtrZKcyrAGyJY 3sxqtzv200kobTuAc6eSWtAQAX9ErxlLHgBv/FikKsL9CIX+oQNbHBuZSbFrEXA9nQ1d NgUg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=3vf4nYaIAsDBcjabT8ATdtFaulkvwKXK93mDR85Qldw=; fh=6Jn+cCKdZh8a6eX3VkCfiiqBdYvOPcKq+v1Kd6bVVQA=; b=RsaVzy50Y6aBe/axqgvPvySSjTRxtj+y+2nYnuuQMlEBRyV2Hh3RdRWUOAj5NE4M2y dXOgEmm//6GNZv3BzZVbDvorMPTCAOj2BDiUGAj28bSIuaP/B4NRd8DIflDpGJAHsbum PFNHC2YeYAWYHUlc5SbWO0OVdxfT1MY3kg8FolS8UdKA9AAzN1wF2tMhEULrvCL1vmRu DKM1E2oCTOHp+GZoEDjK/h0SPbz7928Odn43m7JRrLint1pza0fNIQRJrWtONLsvE7go 06I4lcdFnh9grUMyqzZoeMBWK3q+wsO4FutVeRH4NajIfYEFAW0aAf8RKf5xmFF+Y+0i NLYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=P4gkREO3; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-154552-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154552-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id m67-20020a633f46000000b005f7fd775d79si7447729pga.229.2024.04.22.23.28.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 23:28:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-154552-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=P4gkREO3; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-154552-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154552-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 374582815BB for ; Tue, 23 Apr 2024 06:28:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56B6523749; Tue, 23 Apr 2024 06:28:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P4gkREO3" Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37CEA288DB; Tue, 23 Apr 2024 06:28:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713853711; cv=none; b=QBUz5r40KIZ/Co1wA10GTxcistgO7dDFmsTzzpXMC7Fgt4U5KnNCS9JtyaqmlPV4G+dkovk5vZ51KhnJBX/pVlrpQb36gJ6bfclh9d90wR9dgPdUNoakDVs9P5LukjrqiXEidCFv+X7nxEhrKCU/z3VPH+RzGt8OuVQXuvgjtJQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713853711; c=relaxed/simple; bh=RH3seyAGfFPN3Z3rV3vpTCGAc0jmROThGRyFEPOs0fY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=UfbZl1uV2CuGYYfzJGxBR0KucXTOgyDe+z3Te7jMuq0EslahgnO49IraK2I4jHnYUhegjECSbEnGUxsKMsmMWfubl1aCZJUAvXrsy3bWdLy5RO1fER/yKgYmL2mUhR2wWljMReG7LAOdiOUujHN48Jwl95V9IHhownumVaB+6iQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=P4gkREO3; arc=none smtp.client-ip=209.85.210.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-6eb86b69e65so3140868a34.3; Mon, 22 Apr 2024 23:28:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713853709; x=1714458509; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=3vf4nYaIAsDBcjabT8ATdtFaulkvwKXK93mDR85Qldw=; b=P4gkREO3to1qkuaplsTk+3hYYw3aPzJYKeQo+b//+qnUOL5LT09P0WIQBS5+vD7g5B jp3QqiEAfh9y4Um/H46yFDJR2bouOK7a2qXbkzoj4fERL5FZaoEAp/r43k0hFf9zMbrJ GY+95qMATgptfdfE5BsTXlOM2mxy2Gw9BEpLqFzwbZaWRkv3/TWFjGeiDM4TrJLyVpKp VXn8NT3SCBl6hQGbm5A2hqXsM7e3OdCqnXb/iywnVuTON4nUXKQSTqBx56oDo1102WJo gUsglCzAeKAz2c6SSn2niDo5KzzhB5rvbE3VcFQlmHuXgAQBgmMcql8LBffljABreBzR +a5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713853709; x=1714458509; 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=3vf4nYaIAsDBcjabT8ATdtFaulkvwKXK93mDR85Qldw=; b=FAQQd58bzUzb/R4k+CWmpIcPdq/8N8H5d8ee3IPxZBZk3u7XDrsFKbN6Ao2MwHmHjc wGyFKw+rAtqs5+OBTjb1k7yXw/Y/TUTcaL/x0SR0rfZS6/AYe44OEYj4Gw6HolSr7515 fzmRo1dpOBm9+D+tyJt+8fGdcWoN2qpV1hXml02QSf7Xf8pgSlB99iDzI/dPolrbjvE9 UmmSs2zCz6y83yYhww71H9gF8Hep4RYyTAjnrZ4UHxpy+C8QaujS0SH4tEPjmL82GVSS 0oY2AFk1UrxdOFHuJio6NUu71Poc6/fWwXmWwBrJDDF1XkNMMfLFDPFxaP2C01VCC0/6 bwfg== X-Forwarded-Encrypted: i=1; AJvYcCULKYVuQzvrnBwJxK31q5pnyBINQn8E08pgsvp70Xlqp6GJjoQrCZ0R1kcSJI2dPMwBKtFLABs40r7nXpYWEHm4X1QHUgik1rsCxijKKJutyp7wzn33/FJWtAX/R1s47qotEoY7PXQ= X-Gm-Message-State: AOJu0Yw0k2RBaBL2kzaTklEDGBHKLJSwURRdu64I2XukEtb/czscnO0C 2v6yRrxs8wco1xzcK5o4Q76NgA81/0yMEH7b8YwvbaofEkzlkc5TvklNpbifyDIkMbDq86cnycV 10cXfpqBBs/hoJpKBmTjgdgz6wVs= X-Received: by 2002:a05:6358:5e83:b0:18a:5c27:7032 with SMTP id z3-20020a0563585e8300b0018a5c277032mr15515881rwn.13.1713853709291; Mon, 22 Apr 2024 23:28:29 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <285de20a187f3e4baeb28f639b5bf55e914a3821.1713756666.git.viresh.kumar@linaro.org> <20240423061253.blyfuqasyiatm5sa@vireshk-i7> In-Reply-To: <20240423061253.blyfuqasyiatm5sa@vireshk-i7> From: Julian Calaby Date: Tue, 23 Apr 2024 16:28:17 +1000 Message-ID: Subject: Re: [PATCH] cpufreq: sun50i: Fix build warning around snprint() To: Viresh Kumar Cc: "Rafael J. Wysocki" , Yangtao Li , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , linux-pm@vger.kernel.org, Vincent Guittot , kernel test robot , linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Viresh, On Tue, Apr 23, 2024 at 4:12=E2=80=AFPM Viresh Kumar wrote: > > On 23-04-24, 11:38, Julian Calaby wrote: > > On Mon, Apr 22, 2024 at 1:31=E2=80=AFPM Viresh Kumar wrote: > > > diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c b/drivers/cpufreq= /sun50i-cpufreq-nvmem.c > > > index 30e5c337611c..cd50cea16a87 100644 > > > --- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c > > > +++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c > > > @@ -208,7 +206,7 @@ static int sun50i_cpufreq_get_efuse(void) > > > static int sun50i_cpufreq_nvmem_probe(struct platform_device *pdev) > > > { > > > int *opp_tokens; > > > - char name[MAX_NAME_LEN]; > > > + char name[] =3D "speedXXXXXXXXXXX"; /* Integers can take 11 c= hars max */ > > > > Would it make sense to just set a static length for the string here, > > say 17-20 characters and add a comment explaining the number, say: /* > > "speed" + 11 chars for the int */ > > > > The string constant, while it'll probably be optimised away, seems > > weird and wasteful. > > The counting goes wrong (I have done it in the past) sometimes and so > I like to explicitly reserve space like this, it also makes it look > cleaner, i.e. how the eventual string will be named. I completely agree - ultimately it's whatever works and either way works equally well. Thanks, --=20 Julian Calaby Email: julian.calaby@gmail.com Profile: http://www.google.com/profiles/julian.calaby/