From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752165AbcG2JqV (ORCPT ); Fri, 29 Jul 2016 05:46:21 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:55534 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751095AbcG2JqP (ORCPT ); Fri, 29 Jul 2016 05:46:15 -0400 X-IBM-Helo: d06dlp03.portsmouth.uk.ibm.com X-IBM-MailFrom: sebott@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org;linux-s390@vger.kernel.org Date: Fri, 29 Jul 2016 11:46:08 +0200 (CEST) From: Sebastian Ott X-X-Sender: sebott@schleppi To: Julia Lawall cc: Amitoj Kaur Chawla , Gerald Schaefer , Martin Schwidefsky , Heiko Carstens , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] s390/pci: Remove unnecessary if condition In-Reply-To: References: <20160729083150.GA8819@amitoj-Inspiron-3542> User-Agent: Alpine 2.20 (LFD 67 2015-01-07) Organization: =?ISO-8859-15?Q?=22IBM_Deutschland_Research_&_Development_GmbH_=2F_Vorsitzende_des_Aufsichtsrats=3A_Martina_Koederitz_Gesch=E4ftsf=FChrung=3A_Dirk_Wittkopp_Sitz_der_Gesellschaft=3A_B=F6blingen_=2F_Registergericht?= =?ISO-8859-15?Q?=3A_Amtsgericht_Stuttgart=2C_HRB_243294=22?= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16072909-0028-0000-0000-000001F7628C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16072909-0029-0000-0000-00001FC19D18 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-07-29_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607290102 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 29 Jul 2016, Julia Lawall wrote: > On Fri, 29 Jul 2016, Sebastian Ott wrote: > > On Fri, 29 Jul 2016, Amitoj Kaur Chawla wrote: > > > Remove unnecessary error handling because the only failure value that > > > can be returned is NULL and so the test can never be true. > > > > > > The Coccinelle semantic patch used to make this change is as follows: > > > @@ > > > expression e; > > > @@ > > > > > > e = debugfs_create_file(...); > > > - if(IS_ERR(e)) { e = NULL; } > > > > Nope. For !CONFIG_DEBUG_FS debugfs_create_file returns an ERR_PTR. > > Clicking around in lxr doesn't show that, but perhaps an alternative > definition is overlooked? It looks that way. [sebott@schleppi linux]$ git grep -W "debugfs_create_file(" include/linux/debugfs.h include/linux/debugfs.h:struct dentry *debugfs_create_file(const char *name, umode_t mode, include/linux/debugfs.h- struct dentry *parent, void *data, include/linux/debugfs.h- const struct file_operations *fops); -- include/linux/debugfs.h:static inline struct dentry *debugfs_create_file(const char *name, umode_t mode, include/linux/debugfs.h- struct dentry *parent, void *data, include/linux/debugfs.h- const struct file_operations *fops) include/linux/debugfs.h-{ include/linux/debugfs.h- return ERR_PTR(-ENODEV); include/linux/debugfs.h-} include/linux/debugfs.h- Regards, Sebastian