Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756913AbcJWXiz (ORCPT ); Sun, 23 Oct 2016 19:38:55 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:30363 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755384AbcJWXiv (ORCPT ); Sun, 23 Oct 2016 19:38:51 -0400 X-IronPort-AV: E=Sophos;i="5.31,539,1473091200"; d="scan'";a="23952256" Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Damien.LeMoal@wdc.com; Subject: Re: [PATCH] block: zoned: fix harmless maybe-uninitialized warning To: Arnd Bergmann , Jens Axboe References: <20161021154242.3707589-1-arnd@arndb.de> CC: Shaun Tancheff , "Martin K. Petersen" , Damien Le Moal , Hannes Reinecke , , From: Damien Le Moal Organization: Western Digital Message-ID: <4a2b4842-3849-ead5-f3e2-774a9778eda6@wdc.com> Date: Mon, 24 Oct 2016 08:38:39 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161021154242.3707589-1-arnd@arndb.de> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [199.255.47.8] X-ClientProxiedBy: CO2PR20CA0012.namprd20.prod.outlook.com (10.163.96.22) To BL2PR04MB1970.namprd04.prod.outlook.com (10.167.97.142) X-MS-Office365-Filtering-Correlation-Id: 7a3974df-89a2-46da-5def-08d3fb9dbd01 X-Microsoft-Exchange-Diagnostics: 1;BL2PR04MB1970;2:pcUb15SIdhcJCAgF15UA/sEIAawLMvnf0rvFsnEBj1oTd2jtOtwKzS4qTC17BtvWZkJBGAhJ3yMtKmm4ndVRmUVqKs76IW+n3T91f0MrZk66faSsuukduSMxbuQkid+CNesRADWGltr8Wjjrcehm4CckoEKO5K+O/pdH6vYh3bDfzEwE0LtDQWqhwFhJiwjXO/iw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JJyf2CZlgbYFsRdnkiAKTPwQrvQ0145wOyuv2ZoL5Vh79++g89Ag== X-Microsoft-Exchange-Diagnostics: 1;BL2PR04MB1970;31:seeQ2TriYBrsTEqyKYZ/wt4+ZpM3nxn+Tlh8xk/fBZ876YRVwxNOmPJ9WYJ5XboP1fi9gsRjV4SXNFvWsHxddUnMrQdLsQ01850iZZ5kNzuio8D9LpTxFA7ghbCh3eD11c9Z2u/9noULza9RmXoNZigD3vpthyKStakLYmOA+WZhmHxuc9hvreUbfcuNKfCast/hKKRRQhDiibVnQSwNFF2cU9fs640clrlCLC1/77STQu+ilnX1VR0nf/3VIVsR;20:ZyX1mI7ydwtQCtOSRiTkJ1UivaY3PYFtTQzSS8u7hpU/m5I6uxduEy6QDF8ugJ4lqEAL2JlOrr2BUg9e7Dj0eiGlVnah4FepekE+pfSKR3D1EcikWoBFoKUQt2u/5J3M0DJRF3GrXYQu4t5N93h7RxFc7mOSmH3YIOeHuPOtzjemHBHbUCdaWjqriFUQ7QNyP58/JyU+HAy4bdVnC8KwpZr7F7WC9LjglRfxD6UOFF7p1WhA9k4lQJ/GfHV5wvnsOC7g5sw4akImtonk9f5Tdy0G7UnMd5Es8CKPZDKgvxXqPv6PGMA1fF509IbjiPHr2+aeBKVWtPNCmTCFlTKM2KWUMXavWD/vNCAJPxv5wDTtg04DgT7MvBCDb0X1PFv156MZn8XoQwYnX35BVhk63Ul3s1nkPeKqPNI3PjMIrkDIqCP4RY1ED3EL6v0OgAQsJeL+BOc3D1EwQHljHOcQpcfa9KkXH7UsUTQ8nlU+nxVevh1fdn4cJjWU9A7q3UZZ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(79135771888625)(67367480688388)(56741022784758); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026);SRVR:BL2PR04MB1970;BCL:0;PCL:0;RULEID:;SRVR:BL2PR04MB1970; X-Microsoft-Exchange-Diagnostics: 1;BL2PR04MB1970;4:/jF8WObSxGnYNm7ha661+zHtiAQLGR5fx/VsHhj02K3aFLWxkRNG3kuWykB8pHOiYNXik6wu+Zo+1pci0uusr673e+KfVl4fR/6CgoojuNARX5UaK9LWTCDlV7GBa2Y2MqEsYyiLNTnqB+PjYWxShib3785twIafSnTzgq+hjjFae7cyJXImOnaypus6kVSxyc40JGiT1tUymhIfXyso6GPncPLjs/Mgt/rvNp9VBpWUSIGCD0NaeP1prh8HK4sdZt9/8HJM573b+S8AlKNAH7XuhcRgcHe2YkWffsgv/Zb/dqQ+M2oVvX7vphsQRAB/S2eNdTpreUD8+rYt0nEgKf2aatR1QWWIvN3tCH63PPKkYYMUu+Ymxwh73wlpdXIEKFQ4ppzk+dHpGYhqU1eWWOEyV6SpOl2pzyEe2kHWXKnLLoNwUMGV6cNtO3w+nJzOEZySYskaGjfu3o0IDngVM6xjz2Ws47YODm0cgDe5QPhojRJuCg2jV2n09v/c0WbrKsWKrGPKI2LWNKJRxgJZuLh/GC6Ou4unUscF58tKfGY= X-Forefront-PRVS: 0104247462 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(6049001)(7916002)(189002)(377424004)(24454002)(199003)(575784001)(23746002)(86362001)(2906002)(4001350100001)(31696002)(31686004)(65956001)(65806001)(42186005)(305945005)(47776003)(7736002)(7846002)(81166006)(54356999)(50986999)(66066001)(101416001)(2950100002)(76176999)(81156014)(105586002)(6666003)(8676002)(64126003)(5660300001)(33646002)(189998001)(65826007)(50466002)(68736007)(92566002)(6116002)(3846002)(19580405001)(19580395003)(106356001)(36756003)(15974865002)(5001770100001)(4326007)(97736004)(230700001)(77096005)(586003)(83506001)(7099028)(18886075002);DIR:OUT;SFP:1102;SCL:1;SRVR:BL2PR04MB1970;H:[10.80.171.107];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;BL2PR04MB1970;23:ZCb8EdQcNTMlsJn/4mwiwfUNIv/IdIk/OkU2X?= =?Windows-1252?Q?3JHnmGs9ApGG/5o0StG8q65vlBK6v7+lynn1e7w1QMB6cafndoCyqKRO?= =?Windows-1252?Q?s76IW3rLR29SiMdK+OuAcYAAuZ+/roxJ9JQM9v1vpCkw9ZEoG06Ob/lD?= =?Windows-1252?Q?/atKp4pXoLYDS1pAzMOItWn9xU0+VH5K2Xg4+vActyTpEROWhHsOrtTx?= =?Windows-1252?Q?L1vABkJlnToDj6dSAuSxVj+1OsNjKPjZHwGHjLKDM1iGSRyffsWZeOBy?= =?Windows-1252?Q?jKEFrW3SMgzoauiZxKrSW0VXB3gWj/xu/dnIraEVkQdsYrrNfz4qcF4v?= =?Windows-1252?Q?2ihF9uZ8J7vx7FsZS/nMYBqPFVC5rmayVSSIs2d5e0wRI0YCIYWHds+P?= =?Windows-1252?Q?gyvkuxpQCToU6KGB/aCvahOoscRYU+LqeQJNVhRaoFHbamxvvjjnnwYy?= =?Windows-1252?Q?HGTsUlKjoADYNQECms6Qg727TcqpccclHa/lyQiXdSzS1Vhx5FFYZ+fB?= =?Windows-1252?Q?prwm5JoiSRuZ0F+DvApDOlLryzYz1hbEp3kqbBVMmTe6FZ/VbrM8UgNC?= =?Windows-1252?Q?lkFi2qTLKEmJAnkwsUZ9oyAPXiN9q3KeLDuiGhfSXmoSITqu6rmrnalI?= =?Windows-1252?Q?+kXXEyNthAIZPad+DW7EBW1bkEpJIi4MUowxZmPGnaVnnJFnPivfzY3T?= =?Windows-1252?Q?Nuh2pn6f0EeiFacB4eV1c/tVHpU776XtwRR8zLnDuKRFKZO4dX6pK+Ff?= =?Windows-1252?Q?wBECWheAo4pIm1famLspdip5xc1manRMIUuAgxzuctbuTr0XNZso9XTF?= =?Windows-1252?Q?/hNsj+MQnAK5l80Ljv11ik6LeuNSOzA0cR5im7ERO2pRTQu6IbrK2RFb?= =?Windows-1252?Q?+cQjswJ3vgP5oSFoU+x9N1tVmKLhJlv/3YnWpN0I2RaO3z91ISDmUqJM?= =?Windows-1252?Q?PGZuwsE1hPtuDl+dhSFBYAQpsIZ1srDhnbAl2wHEcFiHoLfeILBHSaLf?= =?Windows-1252?Q?/i3S5RCUyO2BtdFbKeBgvZnS2CySqfq8ymG475FpvPusR0x4Y5Vrr8RL?= =?Windows-1252?Q?NYzoGpSFcbvcVHXWI/z6ryo+Z/J+oixo+PbWfsVFMUjd0rVPe0lNSuCw?= =?Windows-1252?Q?UO1vhO3LESMhnnDSvt0qXhw5d8N6hr1l0eP6wCPgrUvRvTmwvq8J30zY?= =?Windows-1252?Q?rWGZumiz79hmtthJJCbSWA+RNhJGYXrIXoHy+BEiBDFmYnH8FJIAuU+v?= =?Windows-1252?Q?ZKTp6KL5ecqlWvjH1awDr1rKMp7yLcleiDRMwfYIZxEp5euo0aZg3am7?= =?Windows-1252?Q?NsvQOfUDEOjnY74WN3XH2dePt7waMbBtBe9SUObWgyCejTatIzQgLDoP?= =?Windows-1252?Q?P/Mnwvdd+ngDqv/ML3G+a74vLqd2CmnjP7FudqWtZ0cXrDObud7KYelc?= =?Windows-1252?Q?9+RyX9bsbt9q30RXCl0MOapx7XK1J6Mt07YCnfdaWMNtvBURgRnUExM1?= =?Windows-1252?Q?MuUGuA=3D?= X-Microsoft-Exchange-Diagnostics: 1;BL2PR04MB1970;6:EExHlSIVzrh3+91erV34W9NMoNlVMqa2bRgF/a8H/4LR2iDWCkprrQhqK8vZ3pVaUBMesCWY78PbpfPy06YpleH/nNK36iazTt3ifNxRmI3YlFrQ9LE++6VT5O0gBKEBnj98PAYbqDNEPCI61UKnfQquIN2FSo5m5M3deza5z/352wzirhTCix257GELwhMh7V3hEG3oRZjCLZaC8r9O4peSyh92V7uHYWLZJwOnYeePfBsOcV72VSZ4FKZM/ENfg+12Uxq3rhW4aRpYD2KXvMxiwRCEkQ+NGYjcdr+sdnUtUPHmBxcpij/+O70wphjI3ab7/fnB6IA+9rZ20UqZit2414pc2NlIKSYDe+fPKdo=;5:A/hrxAld+4yA31PyZyOB1IbOKwNaOmUwLiQSrMtDMvbN31pWMJyGJeBkE/KC7rvGPHuhBfr+lNHTvuWLsEsWLxzsJsGs9QZuBe9e2J/wKKDAOCDW+l/y1h6dscfliW914frjb8wLY/+vIiloswKOnNsjhV1UoTAFvoHpoq2KD2c=;24:0DYP1wfJlKjzwSz3UXMXp9ALdJC8+RbFvRaH4wkMoW0+G63INYXz+SNxilZBejqna1eYLKa3SbIWWQu0eIJRMGpmvNs4U99JlakMS/joe4A= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BL2PR04MB1970;7:naX9VG/eYagRwdmpMBCY/twlE8p7zVlykQJyre5uMi4W87A2Ekt7Wb+v2XjBts1Rdf/UudtqOpuOasd8izdnl0ixbOIGPV+5BwH66g367DZ8nLI8BrvGE+eqXeLFf41ODgADl7muUmmqmznUl6OWzsHTqeqcGNkwLzHUaY2+m9XyY9EoYswhMQ3SXRw+GvcYOC1kWc3ztCaZvo3OUwPBDT+u1TN5BhZ7TB5b/+RzlV8MJacMWoI/DhsPgFSrdqvKIpToWXn50g7AphOfI6mLZksNi/KivZWzUDAm+spay/1Pfz0ou7GdhVct45w8X9Mm3zaRyFNK1jwnoA7KsqLt9zUx4yIoGN/zSbz8sOaDnMs=;20:djsyUStJW8XDGZdMbPofqW6jtRmqXUJzoDfhl3r4NSZ5YresWkpV5FmWOmxHT0aJpTzQNhbTlrwChUD2h6dUEqKHo5rGcNqcZc7Qi8AFCnlNV0NxLzf4ZZJMigRQl3emu0U7r3/Y6KMNKgyheooHRfb574iJhn4TPkZmCoQaOAlf8acoOBwtjDhvXV6NKz9Vh3/E5nphPkss4AJQSl9BijAwr0oXn4MJYLVrsH8cOSD4pl6f5jCMI4SO7Q4pznRU X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2016 23:38:47.0727 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR04MB1970 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1837 Lines: 62 On 10/22/16 00:42, Arnd Bergmann wrote: > The blkdev_report_zones produces a harmless warning when > -Wmaybe-uninitialized is set, after gcc gets a little confused > about the multiple 'goto' here: > > block/blk-zoned.c: In function 'blkdev_report_zones': > block/blk-zoned.c:188:13: error: 'nz' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > Moving the assignment to nr_zones makes this a little simpler > while also avoiding the warning reliably. I'm removing the > extraneous initialization of 'int ret' in the same patch, as > that is semi-related and could cause an uninitialized use of > that variable to not produce a warning. > > Fixes: 6a0cb1bc106f ("block: Implement support for zoned block devices") > Signed-off-by: Arnd Bergmann > --- > block/blk-zoned.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/block/blk-zoned.c b/block/blk-zoned.c > index 667f95d86695..472211fa183a 100644 > --- a/block/blk-zoned.c > +++ b/block/blk-zoned.c > @@ -80,7 +80,7 @@ int blkdev_report_zones(struct block_device *bdev, > unsigned int i, n, nz; > unsigned int ofst; > void *addr; > - int ret = 0; > + int ret; > > if (!q) > return -ENXIO; > @@ -179,14 +179,12 @@ int blkdev_report_zones(struct block_device *bdev, > > } > > + *nr_zones = nz; > out: > bio_for_each_segment_all(bv, bio, i) > __free_page(bv->bv_page); > bio_put(bio); > > - if (ret == 0) > - *nr_zones = nz; > - > return ret; > } > EXPORT_SYMBOL_GPL(blkdev_report_zones); Reviewed-by: Damien Le Moal -- Damien Le Moal, Ph.D. Sr. Manager, System Software Research Group, Western Digital Corporation Damien.LeMoal@wdc.com (+81) 0466-98-3593 (ext. 513593) 1 kirihara-cho, Fujisawa, Kanagawa, 252-0888 Japan www.wdc.com, www.hgst.com