From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752170AbcF1B7M (ORCPT ); Mon, 27 Jun 2016 21:59:12 -0400 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9]:34065 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752054AbcF1B7K (ORCPT ); Mon, 27 Jun 2016 21:59:10 -0400 Subject: Re: [PATCH 1/1] usb: dwc2: add printf attribute to cat_printf() To: Nicolas Iooss , John Youn , Greg Kroah-Hartman , Felipe Balbi References: <20160626081238.4668-1-nicolas.iooss_linux@m4x.org> CC: "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" From: John Youn Message-ID: <8db5f04a-2d16-854b-9a90-001dc286e18b@synopsys.com> Date: Mon, 27 Jun 2016 18:59:08 -0700 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20160626081238.4668-1-nicolas.iooss_linux@m4x.org> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.9.139.113] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/26/2016 1:12 AM, Nicolas Iooss wrote: > As cat_printf() uses printf format strings in its parameters, adding > __printf attribute allows the compiler to detect at compile-time some > errors related to format strings (with -Wformat warning flag). > > Signed-off-by: Nicolas Iooss > --- > drivers/usb/dwc2/hcd_queue.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c > index b5c7793a2df2..13754353251f 100644 > --- a/drivers/usb/dwc2/hcd_queue.c > +++ b/drivers/usb/dwc2/hcd_queue.c > @@ -367,7 +367,8 @@ static void pmap_unschedule(unsigned long *map, int bits_per_period, > * @fmt: The format for printf. > * @...: The args for printf. > */ > -static void cat_printf(char **buf, size_t *size, const char *fmt, ...) > +static __printf(3, 4) > +void cat_printf(char **buf, size_t *size, const char *fmt, ...) > { > va_list args; > int i; > Acked-by: John Youn John