From patchwork Wed Jul 15 09:52:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 11664683 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 691DD1510 for ; Wed, 15 Jul 2020 09:52:50 +0000 (UTC) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1F8982064B for ; Wed, 15 Jul 2020 09:52:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F8982064B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-280-zuK8OWGsM7e_qvd9nZdLuQ-1; Wed, 15 Jul 2020 05:52:45 -0400 X-MC-Unique: zuK8OWGsM7e_qvd9nZdLuQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6BB931083E83; Wed, 15 Jul 2020 09:52:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4FC95100164C; Wed, 15 Jul 2020 09:52:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 24F9A1809563; Wed, 15 Jul 2020 09:52:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06F9qQYb007875 for ; Wed, 15 Jul 2020 05:52:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id BCC601007A4C; Wed, 15 Jul 2020 09:52:26 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B82831008B99 for ; Wed, 15 Jul 2020 09:52:26 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A0331856A54 for ; Wed, 15 Jul 2020 09:52:26 +0000 (UTC) Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-31-4mThnn_WO1GiFvRF_ZXMkA-2; Wed, 15 Jul 2020 05:52:22 -0400 X-MC-Unique: 4mThnn_WO1GiFvRF_ZXMkA-2 IronPort-SDR: cqrEyjB2yRhHw4OoehUxZvlhvbPF5TtuUPG8vxbayZPET2CP5l8l+Nojh9kTHoI5SIwK5L9EC/ LI3WlbLQr2rrDC39T2vNq6Dl+ecEXHIGwFMCcrNf0o4I27GpMFy92GgdQglsCDzHeDH9opt2lY UmzX1lDvgBWYLoHKLA4PUmy2oljKyXa+/wMwNIC7HecKCEQUftkLi4Jnj2Igo3o5M0BRo12JNg DhS4ijs/jA4lU7JJ40p9y4JrcjAdDSKwi4wbhbPNPmg2icAKhA4Qk2jr8piUTvknStigfs7NVH 6XI= X-IronPort-AV: E=Sophos;i="5.75,354,1589212800"; d="scan'208";a="251769665" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 15 Jul 2020 17:52:20 +0800 IronPort-SDR: y5QE9+t7yVSg7OT7ajQ9/jbM3rsxPoFoLAhvwn8x9GMdioQpS+H5Ubp224SbOXgrRgr9DS7rto YB0q0V2ZEoZjKM0wYO7QPhWl1NxRKhUzU= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2020 02:40:14 -0700 IronPort-SDR: 5RStOCRSiwttNm7b4JOwlxqTev1O/q7SxQjwZRjZw8DjbbW+76SmjiCSLzCsHwgMKpjN/z9Lev VHn5wSGoJexA== WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip01.wdc.com with ESMTP; 15 Jul 2020 02:52:20 -0700 From: Damien Le Moal To: dm-devel@redhat.com, Mike Snitzer Date: Wed, 15 Jul 2020 18:52:12 +0900 Message-Id: <20200715095217.441885-4-damien.lemoal@wdc.com> In-Reply-To: <20200715095217.441885-1-damien.lemoal@wdc.com> References: <20200715095217.441885-1-damien.lemoal@wdc.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: dm-devel@redhat.com Cc: Damien Le Moal Subject: [dm-devel] [PATCH 3/8] md: Fix compilation warning X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Remove the if statement around the calls to sysfs_link_rdev() to avoid the compilation warnings: warning: suggest braces around empty body in an ‘if’ statement when compiling with W=1. For the call to sysfs_create_link() generating the same warning, use the err variable to store the function result, avoiding triggering another warning as the function is declared as 'warn_unused_result'. Signed-off-by: Damien Le Moal --- drivers/md/md.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index f567f536b529..f6c83483a5a2 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -2441,8 +2441,8 @@ static int bind_rdev_to_array(struct md_rdev *rdev, struct mddev *mddev) goto fail; ko = &part_to_dev(rdev->bdev->bd_part)->kobj; - if (sysfs_create_link(&rdev->kobj, ko, "block")) - /* failure here is OK */; + /* failure here is OK */ + err = sysfs_create_link(&rdev->kobj, ko, "block"); rdev->sysfs_state = sysfs_get_dirent_safe(rdev->kobj.sd, "state"); list_add_rcu(&rdev->same_set, &mddev->disks); @@ -3202,8 +3202,8 @@ slot_store(struct md_rdev *rdev, const char *buf, size_t len) return err; } else sysfs_notify_dirent_safe(rdev->sysfs_state); - if (sysfs_link_rdev(rdev->mddev, rdev)) - /* failure here is OK */; + /* failure here is OK */; + sysfs_link_rdev(rdev->mddev, rdev); /* don't wakeup anyone, leave that to userspace. */ } else { if (slot >= rdev->mddev->raid_disks && @@ -9060,8 +9060,8 @@ static int remove_and_add_spares(struct mddev *mddev, rdev->recovery_offset = 0; } if (mddev->pers->hot_add_disk(mddev, rdev) == 0) { - if (sysfs_link_rdev(mddev, rdev)) - /* failure here is OK */; + /* failure here is OK */ + sysfs_link_rdev(mddev, rdev); if (!test_bit(Journal, &rdev->flags)) spares++; md_new_event(mddev);