Return-path: Received: from mms3.broadcom.com ([216.31.210.19]:4244 "EHLO MMS3.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751979Ab2BXLSt convert rfc822-to-8bit (ORCPT ); Fri, 24 Feb 2012 06:18:49 -0500 Message-ID: <4F477211.60506@broadcom.com> (sfid-20120224_121853_156393_93CD99BC) Date: Fri, 24 Feb 2012 12:18:41 +0100 From: "Arend van Spriel" MIME-Version: 1.0 To: "Johannes Berg" cc: =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , "linux-wireless@vger.kernel.org" , "Saul St. John" , "Hauke Mehrtens" , "Larry Finger" Subject: Re: [RFC] bcma: add support for on-chip OTP memory used for SPROM storage References: <1330033977-5741-1-git-send-email-arend@broadcom.com> <4F4768D0.4030109@broadcom.com> (sfid-20120224_113946_190994_AFCFACFE) <1330081083.3426.15.camel@jlt3.sipsolutions.net> In-Reply-To: <1330081083.3426.15.camel@jlt3.sipsolutions.net> Content-Type: text/plain; charset=utf-8; format=flowed Sender: linux-wireless-owner@vger.kernel.org List-ID: On 02/24/2012 11:58 AM, Johannes Berg wrote: > On Fri, 2012-02-24 at 11:39 +0100, Arend van Spriel wrote: >> On 02/24/2012 08:52 AM, Rafał Miłecki wrote: >>>> + srom_control = bcma_read32(bus->drv_cc.core, >>>>> + BCMA_CC_SROM_CONTROL); >>>>> + return !!(srom_control& BCMA_CC_SROM_CONTROL_PRESENT); >>> Does any compiler complain on returning sth like 0xF as a bool? >>> >> >> The compiler probably will not complain, but the caller could have >> following: >> >> if (bcma_sprom_ext_available(bus) == true) { >> return; >> } >> BUG(); >> >> I guess you would see the BUG show up in your log with the function >> returning 0xF. > > If it's really > > bool foo = a& b; > > then the compiler has to compile that as if it was > > u8 foo = !!(a& b); > > since bool can only carry the values 0 and 1. > > So the !! isn't necessary. > > johannes > > I guess the compiler will convert the return value to _Bool (aka. bool) so indeed !! is not necessary. I will remove it. Gr. AvS