Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp750732pxb; Wed, 18 Aug 2021 13:16:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoZ6R1MyhM0AJ89N15TY3B/oo6Idi5Zut7FEhoU210NRlKoAx4KCqS1533ZhYLMgeotFwP X-Received: by 2002:a02:860d:: with SMTP id e13mr9719668jai.12.1629317814405; Wed, 18 Aug 2021 13:16:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1629317814; cv=pass; d=google.com; s=arc-20160816; b=GM37Rf0JE9oGz0hBYEXJE4KjLmDA6cVe5oMD3mJPHexhQiJZWkGQLLon9wK+Pj3hHN +UxWEF1x25M+28e3CPusNMe6n1HKB5ddtHO8dqKN+gliNbeAntoQ2wJz9mb1AAQueAWt WRDJf9tNbnswQgejX7kiLCS/xhiuhnq8+Y/hEqFJ8JojJdF8ZARsJsKmZhH1+teloLBr AddLQflYjSOk0qBYmSl+E/j4g9Oc8ELpy00ZCYoD/1G+MwkLupYaiWQ5w2+BMSll7FW+ GF4Z6izExwBcWuzN8IRfwSx9vJGSsYLlPCtK5XLSUNKZPKbF8ch9YT/XmYk922KmCWJK uXBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ZQ/waZgJwLCEzD0vKdhEjQNqAq65vN1RjzSS2C3sGcY=; b=lNkHrFe4/3eUNt/sb46cfAmyc/XJ1rB/3W5EXGQKz4nJgfwSxSLnKHTsFBHAHwou39 ophi7LNZLpwm3j++P3akirdokqWkO+bCDBFuSh5iiMXtQb61hZLC4p69LEUB4lnzqC4l fspNPZcGLCgfNk6dHXLsNFfF4ZZMhKbVnPP+Sr7aqDO4xioYfFQb/sZEYlTc4EGC0yKl WtuDOPgsY3hcr21d1ZSO6hqPRWYgzDBs7vnXq0EOmB4bfqsEUZbF7Xjnu0RZD5g9Yx21 +5SXHTp+2IgRg1PLS5xgIQFfQzyVjKAhnUUhpeQwu6qBtCGsJt91NEXZXKvgYERTF3w+ j7SQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@iki.fi header.s=meesny header.b=C+UGn3Yt; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f18si659153iox.32.2021.08.18.13.16.42; Wed, 18 Aug 2021 13:16:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@iki.fi header.s=meesny header.b=C+UGn3Yt; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233153AbhHRUQb (ORCPT + 99 others); Wed, 18 Aug 2021 16:16:31 -0400 Received: from meesny.iki.fi ([195.140.195.201]:42156 "EHLO meesny.iki.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232713AbhHRUQ2 (ORCPT ); Wed, 18 Aug 2021 16:16:28 -0400 Received: from hillosipuli.retiisi.eu (dbd1vftgng281pd4yskly-3.rev.dnainternet.fi [IPv6:2001:14ba:8eb:1240:ab2d:b956:f00:7a12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sailus) by meesny.iki.fi (Postfix) with ESMTPSA id 5F579200CE; Wed, 18 Aug 2021 23:15:47 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1629317747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZQ/waZgJwLCEzD0vKdhEjQNqAq65vN1RjzSS2C3sGcY=; b=C+UGn3YtMdsAxR4A9zeUGrESIsr9H/Cnt9sWDzG5Qx7bqNzzML/YBICIZ6mq75XqAiNlZF x2GXswnMrdsZofJOl0u8oPfw1IAoI4hjsv8ctGGgMYticnXc/9Jkug64xkDFlUBpAFnJPt vzAmIx1w6Lbb75tMwFDl4+ifUBAupAA= Received: from valkosipuli.retiisi.eu (unknown [192.168.4.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hillosipuli.retiisi.eu (Postfix) with ESMTPS id 2685B634C3A; Wed, 18 Aug 2021 23:13:31 +0300 (EEST) Date: Wed, 18 Aug 2021 23:15:46 +0300 From: Sakari Ailus To: Laurent Pinchart Cc: Krzysztof =?utf-8?Q?Ha=C5=82asa?= , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] Driver for ON Semi AR0521 camera sensor Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1629317747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZQ/waZgJwLCEzD0vKdhEjQNqAq65vN1RjzSS2C3sGcY=; b=KmHu+q13MsxDoH5Kb+yOL93O9VJpwawNyQDuG5Dd5VHXu4MjLq0FewQhQ3qruLrDuFpNvH F5JArj2eB4MbABujiCG4eEvxIjkpu1EqNHse2YDM4bL3YFUsIRBn0U3FfRQN4ZePAajL0H 81rQmnlXOxd8niJckiSikJwcMkQzX4M= ARC-Seal: i=1; s=meesny; d=iki.fi; t=1629317747; a=rsa-sha256; cv=none; b=uWFWJ2c3zluOAW5WF6iGWC05gWKr1y2ARuLiDG89Lttarv1PEzl1pIfmYR+NLzzOeA+ys+ PmBAG18+gzjgMRSX3QuqvFE9BilWtpjvZw72U+CV3/pCgmvKKOJIGX2rZDRxVK5BQJi9HV XAJNVU2soQjtwmLmVm+fWjOp0KMBqb0= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=sailus smtp.mailfrom=sakari.ailus@iki.fi Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 18, 2021 at 07:48:30PM +0300, Laurent Pinchart wrote: > > > +static const char *mhz(u32 value) > > > +{ > > > + static char buff[32]; > > > + > > > + if (value % 1000) > > > + sprintf(buff, "%u.%06u", value / (1000 * 1000), value % (1000 * 1000)); > > > + else if (value % (1000 * 1000)) > > > + sprintf(buff, "%u.%03u", value / (1000 * 1000), (value / 1000) % 1000); > > > + else > > > + sprintf(buff, "%u", value / (1000 * 1000)); > > > + return buff; > > > > Sorry, you can't do that. buff is allocated in the stack and the memory is > > no longer available once the function returns. > > It's a static char array, so it won't be allocated on the stack, but > it's still bad practice as it's not thread-safe. Given that it's used in Ah, yeah. I missed the static there. > two debugging messages only, I'd hardcode the %u.06%u format in the > callers. Or just plain number in Hz. Both are fine though. -- Sakari Ailus