Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752014AbbFHFZW (ORCPT ); Mon, 8 Jun 2015 01:25:22 -0400 Received: from st11p00im-asmtp003.me.com ([17.172.80.97]:60540 "EHLO st11p00im-asmtp003.me.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751350AbbFHFZS (ORCPT ); Mon, 8 Jun 2015 01:25:18 -0400 From: Louis Langholtz To: linux-kernel@vger.kernel.org Cc: trivial@kernel.org, htejun@gmail.com, rusty@rustcorp.com.au, akpm@linux-foundation.org, torvalds@linux-foundation.org, Louis Langholtz Subject: [PATCH v2] kernel/params.c: make use of unused but set variable Date: Sun, 07 Jun 2015 23:24:53 -0600 Message-id: <1433741093-20665-1-git-send-email-lou_langholtz@me.com> X-Mailer: git-send-email 1.9.5 (Apple Git-50.3) In-reply-to: <20150608005848.GA21465@mtj.duckdns.org> References: <20150608005848.GA21465@mtj.duckdns.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151,1.0.33,0.0.0000 definitions=2015-06-08_05:2015-06-05,2015-06-08,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-1506080102 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1174 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 WARN_ON_ONCE(). 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 warns 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..49406f9 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); + WARN_ON_ONCE(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/