Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp860022img; Fri, 22 Mar 2019 10:04:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9JefqXPjmvXK7s4p8hpZJtOK41L+BQPgD6UGv51KjV6/7OR5xfHkgwSf+ThjZidSTfwwy X-Received: by 2002:a63:4b0a:: with SMTP id y10mr9867060pga.66.1553274291929; Fri, 22 Mar 2019 10:04:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553274291; cv=none; d=google.com; s=arc-20160816; b=mnD+HLWaTVoCxui2gTOLtfNASgbEf5kRJVasMIqoEEZLx1LtmkZIVMQj8X0KlNxLyO 1xFfQyoOlqLnP2aIa86DvTTTmbA2VwVuad7rjS18m3zsgzldz/5CplctNJ6nn1R7i24M MitB2SKKcYG175j9UnN2TSt0IRTksR5Tylwu7sR+k/+ff+vMizBH0sLNvAa2TaxL60Kq ppfM/mKFKjN2uDRJ2lUmW8Hko2xkadYU4IPpTDyJPeAeCZQx7mdAUGN2eCBKKmewE+pe QeaCwpZfHp0amlDX4Jl7NYWlZOLzH6cmlvi9AmbIphgYVwp7zgnSo98oWPACOILYoBXi vmng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=kbPxMGulCley81DT3KDLKJnooQE9XOZHR8sNDm4mkE4=; b=d4ixK2MU7u+QLrWGL/etBaSJ9/Mkyu8ModIWfFVufA4r62Qu0KfVVWQUivavoJmHTk X8ZgIuwrHtNdX4Mju9NRcbRDbJhIqG3ineN3sYGkAkHBMw0hsPgp2RmKfC6dMjWr2/RO ixNiVWC4LzW0yK4QjX7a3JiBXP96gb/ADOZlBhbf9a915nWIadBBwBSgwf9yI4OYZPfo dzWhye5IRBLGVB6IlP7otdVLDS+usTsX4mxjjvguaprgeWa6nxuTJ+0rwqTQSFd8W9uf aGEQ4I2pS3kwXQIMeDD2+WUActrv/Aw+5fsda34wUjSM2yi2hkCZuEobDMRBXcupXWW4 l7bA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bg3si7233475plb.363.2019.03.22.10.04.37; Fri, 22 Mar 2019 10:04:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728473AbfCVRDr (ORCPT + 99 others); Fri, 22 Mar 2019 13:03:47 -0400 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:42472 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727105AbfCVRDr (ORCPT ); Fri, 22 Mar 2019 13:03:47 -0400 Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2MGmxm2013963; Fri, 22 Mar 2019 12:03:36 -0500 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from mail1.cirrus.com (mail1.cirrus.com [141.131.3.20]) by mx0a-001ae601.pphosted.com with ESMTP id 2ratnq73b1-1; Fri, 22 Mar 2019 12:03:36 -0500 Received: from EX17.ad.cirrus.com (unknown [172.20.9.81]) by mail1.cirrus.com (Postfix) with ESMTP id CFF0B60D9775; Fri, 22 Mar 2019 12:03:35 -0500 (CDT) Received: from imbe.wolfsonmicro.main (198.61.95.81) by EX17.ad.cirrus.com (172.20.9.81) with Microsoft SMTP Server id 14.3.408.0; Fri, 22 Mar 2019 17:03:35 +0000 Received: from ediswmail.ad.cirrus.com (ediswmail.ad.cirrus.com [198.61.86.93]) by imbe.wolfsonmicro.main (8.14.4/8.14.4) with ESMTP id x2MH3XRg024118; Fri, 22 Mar 2019 17:03:34 GMT Date: Fri, 22 Mar 2019 17:03:33 +0000 From: Charles Keepax To: Arnd Bergmann CC: Lee Jones , , Nick Desaulniers , Nathan Chancellor , Linus Walleij , Sapthagiri Baratam , Colin Ian King , , Subject: Re: [PATCH] mfd: arizona: fix undefined behavior Message-ID: <20190322170333.GD46536@ediswmail.ad.cirrus.com> References: <20190322143345.1208144-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20190322143345.1208144-1-arnd@arndb.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=636 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903220123 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 22, 2019 at 03:33:37PM +0100, Arnd Bergmann wrote: > When the driver is used with a subdevice that is disabled in the > kernel configuration, clang gets a little confused about the > control flow and fails to notice that n_subdevs is only > uninitialized when subdevs is NULL, and we check for that, > leading to a false-positive warning: > > drivers/mfd/arizona-core.c:1423:19: error: variable 'n_subdevs' is uninitialized when used here > [-Werror,-Wuninitialized] > subdevs, n_subdevs, NULL, 0, NULL); > ^~~~~~~~~ > drivers/mfd/arizona-core.c:999:15: note: initialize the variable 'n_subdevs' to silence this warning > int n_subdevs, ret, i; > ^ > = 0 > > Ideally, we would rearrange the code to avoid all those early > initializations and have an explicit exit in each disabled case, > but it's much easier to chicken out and add one more initialization > here to shut up the warning. > > Signed-off-by: Arnd Bergmann > --- Acked-by: Charles Keepax Thanks, Charles