Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751703AbbFHAyv (ORCPT ); Sun, 7 Jun 2015 20:54:51 -0400 Received: from st11p00im-asmtp001.me.com ([17.172.80.95]:44965 "EHLO st11p00im-asmtp001.me.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751211AbbFHAym (ORCPT ); Sun, 7 Jun 2015 20:54:42 -0400 X-Greylist: delayed 3600 seconds by postgrey-1.27 at vger.kernel.org; Sun, 07 Jun 2015 20:54:42 EDT X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151,1.0.33,0.0.0000 definitions=2015-06-08_01:2015-06-05,2015-06-07,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=4 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1412110000 definitions=main-1506070336 From: Louis Langholtz To: linux-kernel@vger.kernel.org Cc: trivial@kernel.org, htejun@gmail.com, rusty@rustcorp.com.au, akpm@linux-foundation.org, Louis Langholtz Subject: [PATCH] kernel/params.c: make use of unused but set variable Date: Sun, 07 Jun 2015 17:54:30 -0600 Message-id: <1433721270-9182-1-git-send-email-lou_langholtz@me.com> X-Mailer: git-send-email 1.9.5 (Apple Git-50.3) In-reply-to: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1179 Lines: 28 While Rusty Russell wants the return value of sysfs_create_file ignored, it's annotated '__must_check'. Tejun Heo made the annotaion and suggests just using BUG_ON(). Meanwhile the compiler warns that the 'err' variable is set but unused. This patch uses Tejun's suggestion. This eliminates the warning, satisfies the required check, and fails-fast with notice if sysfs_create_file actually ever fails (something that Rusty says should never happen when this code runs). Signed-off-by: Louis Langholtz --- diff --git a/kernel/params.c b/kernel/params.c index a22d6a7..b04a752 100644 --- a/kernel/params.c +++ b/kernel/params.c @@ -853,6 +853,7 @@ static void __init version_sysfs_builtin(void) mk = locate_module_kobject(vattr->module_name); if (mk) { err = sysfs_create_file(&mk->kobj, &vattr->mattr.attr); + BUG_ON(err); kobject_uevent(&mk->kobj, KOBJ_ADD); kobject_put(&mk->kobj); } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/