From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Garzik Date: Tue, 13 Mar 2012 20:45:14 +0000 Subject: Re: [PATCH v3] drivers/ata/pata_mpc52xx.c: clean up error handling code Message-Id: <4F5FB1DA.6070009@pobox.com> List-Id: References: <1331496729-12850-1-git-send-email-Julia.Lawall@lip6.fr> In-Reply-To: <1331496729-12850-1-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Julia Lawall Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring , linux-ide-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, wharms-fPG8STNUNVg@public.gmane.org On 03/11/2012 04:12 PM, Julia Lawall wrote: > From: Julia Lawall > > This patch makes a number of changes with respect to the error-handling > code: > > * Remove cleanup calls for the devm functions in both the error handling > code and the remove function. This cleanup is done automatically. > > * The previous change simplifies the cleanup code at the end of the > function such that there is nothing to do on the failure of the call to > devm_ioremap. So it is changed to just return directly. > > * There is no need for the ifs in the cleanup code at the end of the > function, because in each case the cleanup needed is statically > known. Drop the ifs, add new err labels, and drop the initializations of > the tested variables to NULL. > > * Change the call to request_irq to a call to devm_request_irq, so that it > is cleaned up on exit. > > * Cause the return value of devm_request_irq to go into the returned > variable rv rather than the unused variable ret. Drop ret. > > Signed-off-by: Julia Lawall > > --- > This subsumes the previous patch that only removed the calls to the devm > cleanup functions. It is not tested. I am not sure about the correctness > of the use of devm_request_irq, since there were no calls to free_irq > before. I also don't know if there was a reason for not returning the > return value of request_irq previously. > > drivers/ata/pata_mpc52xx.c | 44 +++++++++++++++----------------------------- > 1 file changed, 15 insertions(+), 29 deletions(-) applied From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Garzik Subject: Re: [PATCH v3] drivers/ata/pata_mpc52xx.c: clean up error handling code Date: Tue, 13 Mar 2012 16:45:14 -0400 Message-ID: <4F5FB1DA.6070009@pobox.com> References: <1331496729-12850-1-git-send-email-Julia.Lawall@lip6.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1331496729-12850-1-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Sender: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org To: Julia Lawall Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring , linux-ide-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, wharms-fPG8STNUNVg@public.gmane.org List-Id: linux-ide@vger.kernel.org On 03/11/2012 04:12 PM, Julia Lawall wrote: > From: Julia Lawall > > This patch makes a number of changes with respect to the error-handling > code: > > * Remove cleanup calls for the devm functions in both the error handling > code and the remove function. This cleanup is done automatically. > > * The previous change simplifies the cleanup code at the end of the > function such that there is nothing to do on the failure of the call to > devm_ioremap. So it is changed to just return directly. > > * There is no need for the ifs in the cleanup code at the end of the > function, because in each case the cleanup needed is statically > known. Drop the ifs, add new err labels, and drop the initializations of > the tested variables to NULL. > > * Change the call to request_irq to a call to devm_request_irq, so that it > is cleaned up on exit. > > * Cause the return value of devm_request_irq to go into the returned > variable rv rather than the unused variable ret. Drop ret. > > Signed-off-by: Julia Lawall > > --- > This subsumes the previous patch that only removed the calls to the devm > cleanup functions. It is not tested. I am not sure about the correctness > of the use of devm_request_irq, since there were no calls to free_irq > before. I also don't know if there was a reason for not returning the > return value of request_irq previously. > > drivers/ata/pata_mpc52xx.c | 44 +++++++++++++++----------------------------- > 1 file changed, 15 insertions(+), 29 deletions(-) applied From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754196Ab2CMUpU (ORCPT ); Tue, 13 Mar 2012 16:45:20 -0400 Received: from mail-yw0-f46.google.com ([209.85.213.46]:55077 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750841Ab2CMUpR (ORCPT ); Tue, 13 Mar 2012 16:45:17 -0400 Message-ID: <4F5FB1DA.6070009@pobox.com> Date: Tue, 13 Mar 2012 16:45:14 -0400 From: Jeff Garzik User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 MIME-Version: 1.0 To: Julia Lawall CC: kernel-janitors@vger.kernel.org, Grant Likely , Rob Herring , linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, wharms@bfs.de, w.sang@pengutronix.de, agust@denx.de Subject: Re: [PATCH v3] drivers/ata/pata_mpc52xx.c: clean up error handling code References: <1331496729-12850-1-git-send-email-Julia.Lawall@lip6.fr> In-Reply-To: <1331496729-12850-1-git-send-email-Julia.Lawall@lip6.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/11/2012 04:12 PM, Julia Lawall wrote: > From: Julia Lawall > > This patch makes a number of changes with respect to the error-handling > code: > > * Remove cleanup calls for the devm functions in both the error handling > code and the remove function. This cleanup is done automatically. > > * The previous change simplifies the cleanup code at the end of the > function such that there is nothing to do on the failure of the call to > devm_ioremap. So it is changed to just return directly. > > * There is no need for the ifs in the cleanup code at the end of the > function, because in each case the cleanup needed is statically > known. Drop the ifs, add new err labels, and drop the initializations of > the tested variables to NULL. > > * Change the call to request_irq to a call to devm_request_irq, so that it > is cleaned up on exit. > > * Cause the return value of devm_request_irq to go into the returned > variable rv rather than the unused variable ret. Drop ret. > > Signed-off-by: Julia Lawall > > --- > This subsumes the previous patch that only removed the calls to the devm > cleanup functions. It is not tested. I am not sure about the correctness > of the use of devm_request_irq, since there were no calls to free_irq > before. I also don't know if there was a reason for not returning the > return value of request_irq previously. > > drivers/ata/pata_mpc52xx.c | 44 +++++++++++++++----------------------------- > 1 file changed, 15 insertions(+), 29 deletions(-) applied