From patchwork Thu Nov 27 06:00:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stewart Smith X-Patchwork-Id: 415385 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 83306140292 for ; Thu, 27 Nov 2014 17:00:15 +1100 (AEDT) Received: from ozlabs.org (ozlabs.org [103.22.144.67]) by lists.ozlabs.org (Postfix) with ESMTP id 2CD501A09BD for ; Thu, 27 Nov 2014 17:00:15 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id E69991A09B6 for ; Thu, 27 Nov 2014 17:00:12 +1100 (AEDT) Received: from /spool/local by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 26 Nov 2014 23:00:09 -0700 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 26 Nov 2014 23:00:07 -0700 Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 69CAB3E4003E for ; Wed, 26 Nov 2014 22:55:18 -0700 (MST) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sAR60pvY46661786 for ; Wed, 26 Nov 2014 23:00:51 -0700 Received: from d03av02.boulder.ibm.com (localhost [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sAR6065E031108 for ; Wed, 26 Nov 2014 23:00:06 -0700 Received: from oc8180480414.ibm.com ([9.192.167.238]) by d03av02.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with SMTP id sAR604RH030910 for ; Wed, 26 Nov 2014 23:00:04 -0700 Received: by oc8180480414.ibm.com (Postfix, from userid 500) id 9D3934F94; Thu, 27 Nov 2014 17:00:02 +1100 (AEDT) From: Stewart Smith To: skiboot@lists.ozlabs.org User-Agent: Notmuch/0.18+16~gec02089 (http://notmuchmail.org) Emacs/23.1.1 (x86_64-redhat-linux-gnu) Date: Thu, 27 Nov 2014 17:00:02 +1100 Message-ID: MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14112706-0013-0000-0000-000006909488 Subject: [Skiboot] warn_unused_result for fsp_queue_msg() X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" I recently added a bunch of __warn_unused_result around the place. I tried adding it here to see what would happen: and funnily enough, I ended up getting a *lot* of warnings. It seems we're quite sporadic in checking the result of fsp_queue_msg. there's a bunch of places in fsp.c which are all early boot and if we ever fail we should probably just abort - as this likely means we've somehow really screwed up by not detecting an FSP (thus active_fsp is NULL... I don't *think* there's anywhere but early boot where this could be the case) or we fail at allocating the fsp message (and ENOMEM during early boot is... well.. abort worthy). The bits that are interesting are runtime conditions... where we could run out of memory (eep!) and the typical call pattern is fsp_queue_msg(fsp_mkmsg()). So... what are peoples thoughts on this? I'm rather tempted to enable the warning and then force us to go and fix everywhere... and in the meantime spew warnings. --- a/include/fsp.h +++ b/include/fsp.h @@ -661,7 +661,7 @@ extern void fsp_cancelmsg(struct fsp_msg *msg); * commands to the FSP. */ extern int fsp_queue_msg(struct fsp_msg *msg, - void (*comp)(struct fsp_msg *msg)); + void (*comp)(struct fsp_msg *msg)) __warn_unused_result; /* Synchronously send a command. If there's a response, the status is * returned as a positive number. A negative result means an error