Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756310AbcKEQj4 (ORCPT ); Sat, 5 Nov 2016 12:39:56 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35062 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752918AbcKEQjz (ORCPT ); Sat, 5 Nov 2016 12:39:55 -0400 Date: Sat, 5 Nov 2016 16:38:44 +0000 From: Eric Engestrom To: Christian =?utf-8?B?S8O2bmln?= Cc: linux-kernel@vger.kernel.org, Ville =?utf-8?B?U3lyasOkbMOk?= , Alex Deucher , David Airlie , Xinliang Liu , Daniel Vetter , Jani Nikula , VMware Graphics , Sinclair Yeh , Thomas Hellstrom , Tom St Denis , Michel =?utf-8?Q?D=C3=A4nzer?= , Gustavo Padovan , Emily Deng , Chunming Zhou , Flora Cui , Vitaly Prosyak , Ken Wang , Colin Ian King , Alexandre Demers , Junwei Zhang , Xinwei Kong , Chris Wilson , Laurent Pinchart , Wei Yongjun , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: Re: [PATCH] drm: move allocation out of drm_get_format_name() Message-ID: <20161105163844.GA29546@engestrom.ch> References: <20161105012344.GA28349@engestrom.ch> <20161105013325.3889-1-eric@engestrom.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 795 Lines: 21 On Saturday, 2016-11-05 13:11:36 +0100, Christian König wrote: > Am 05.11.2016 um 02:33 schrieb Eric Engestrom: > > +typedef char drm_format_name_buf[32]; > > Please don't use a typedef for this, just define the maximum size of > characters the function might write somewhere. > > See the kernel coding style as well: > > In general, a pointer, or a struct that has elements that can reasonably > > be directly accessed should **never** be a typedef. > I would normally agree as I tend to hate typedefs ($DAYJOB {ab,mis}uses them way too much), and your way was what I wrote at first, but Rob Clark's typedef idea makes it much harder for someone to allocate a buffer of the wrong size, which IMO is good thing here. I can rewrite the typedef out if you think it's better. Cheers, Eric