From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from galahad.ideasonboard.com ([185.26.127.97]:41453 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751744AbeB1I7F (ORCPT ); Wed, 28 Feb 2018 03:59:05 -0500 From: Laurent Pinchart To: SF Markus Elfring Cc: linux-media@vger.kernel.org, Al Viro , Andi Shyti , Andrew Morton , Andrey Utkin , Arvind Yadav , Bhumika Goyal , Bjorn Helgaas , Brian Johnson , Christoph =?ISO-8859-1?Q?B=F6hmwalder?= , Christophe Jaillet , Colin Ian King , Daniele Nicolodi , David =?ISO-8859-1?Q?H=E4rdeman?= , Devendra Sharma , "Gustavo A. R. Silva" , Hans Verkuil , Inki Dae , Joe Perches , Kees Cook , Masahiro Yamada , Mauro Carvalho Chehab , Max Kellermann , Mike Isely , Philippe Ombredanne , Sakari Ailus , Santosh Kumar Singh , Satendra Singh Thakur , Sean Young , Seung-Woo Kim , Shyam Saini , Thomas Gleixner , Todor Tomov , Wei Yongjun , LKML , kernel-janitors@vger.kernel.org Subject: Re: [v2] [media] Use common error handling code in 20 functions Date: Wed, 28 Feb 2018 10:59:52 +0200 Message-ID: <3444809.dyh5Vmx7Dp@avalon> In-Reply-To: <783e7eff-2028-72be-b83c-77fc4340484e@users.sourceforge.net> References: <227d2d7c-5aee-1190-1624-26596a048d9c@users.sourceforge.net> <3895609.4O6dNuP5Wm@avalon> <783e7eff-2028-72be-b83c-77fc4340484e@users.sourceforge.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-media-owner@vger.kernel.org List-ID: Hello, On Wednesday, 28 February 2018 10:45:21 EET SF Markus Elfring wrote: > >> +put_isp: > >> + omap3isp_put(video->isp); > >> +delete_fh: > >> + v4l2_fh_del(&handle->vfh); > >> + v4l2_fh_exit(&handle->vfh); > >> + kfree(handle); > > > > Please prefix the error labels with error_. > > How often do you really need such an extra prefix? > > >> +++ b/drivers/media/usb/uvc/uvc_v4l2.c > >> @@ -994,10 +994,8 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, > >> void *fh, struct v4l2_queryctrl qc = { .id = ctrl->id }; > >> > >> ret = uvc_query_v4l2_ctrl(chain, &qc); > >> > >> - if (ret < 0) { > >> - ctrls->error_idx = i; > >> - return ret; > >> - } > >> + if (ret < 0) > >> + goto set_index; > >> > >> ctrl->value = qc.default_value; > >> > >> } > >> > >> @@ -1013,14 +1011,17 @@ static int uvc_ioctl_g_ext_ctrls(struct file > >> *file, > >> void *fh, ret = uvc_ctrl_get(chain, ctrl); > >> > >> if (ret < 0) { > >> > >> uvc_ctrl_rollback(handle); > >> > >> - ctrls->error_idx = i; > >> - return ret; > >> + goto set_index; > >> > >> } > >> > >> } > >> > >> ctrls->error_idx = 0; > >> > >> return uvc_ctrl_rollback(handle); > >> > >> + > >> +set_index: > >> + ctrls->error_idx = i; > >> + return ret; > >> > >> } > > > > For uvcvideo I find this to hinder readability > > I got an other development view. > > > without adding much added value. > > There can be a small effect for such a function implementation. > > > Please drop the uvcvideo change from this patch. > > Would it be nice if this source code adjustment could be integrated also? Just for the record, and to avoid merging this patch by mistake, Nacked-by: Laurent Pinchart at least until the requested changes are implemented. -- Regards, Laurent Pinchart