Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2813752pxa; Mon, 17 Aug 2020 21:14:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqh9wj6AEO3+HnqJZxmAeIpEG4idBZlEIT70SKqD2cgDZvwA30iTV/v3EfY9mB88Keo+d3 X-Received: by 2002:a17:906:4007:: with SMTP id v7mr18701861ejj.197.1597724040161; Mon, 17 Aug 2020 21:14:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597724040; cv=none; d=google.com; s=arc-20160816; b=BtQusA+zCm+QPLDhgVzMaXrF3Umulmpzd5q/hB70QDJe/Y82JUdf6ZsltFYmA0CQ1w KFmUVSQ9wG9RN4P3GhxyN172wqLiYgab1rfwGKInGU7K6nwEG686ziGy3QdbLXHzE1HU O2JkzpCZhZcuju0VcUG5r7bb/c/nCbqPlqr+2VgSwjpIyn1Ahxla4EccBMHx6Yi8fcyS iZSTf8CGF0Ee83raiLpm+u0ICrSjVRo52b6q3t83HwNNpedlUzbWVY+AjsaBgGqreOKY Y9wR1II+NYr1KbwBR/ws77UcCOgqh+Ls3BFn/KuY+0mf834SkszLXKIyqYE69PSTyZ2l WHEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=hXLCDfrcY5+egor1E3ATfAy15D+Z8YefF1V4ZEaEKWs=; b=x1bwKy42sivqt340e9l664Nb79fDx7Xb4Zfcjr6xpULLhLSTToQxyxy/6OZpqsmOZI 2ZdbzU99wJkOaF8oznM+lu+1KEaxaFVS7KM5spmMydx8dQrPlGS1YRNvAbk1Nu+0s8ke 4Mev0WEJNQHLMHNqX6LQ/FUNkbzj7crOvfEnNHgpRM42WtTyWAw/Z79zPSI6CqyNo+++ f1TMbpD5j3oIm2rFp+yCawznzSvzdwtkuKAnF+tV/BXN5bYDL1+00ogwttkOCa1aBhNa EwQJPdOQNbEf6mQdsmTvNFeOt1kzKsMdDGj4HOYh6px87OQ8h4n2mPUOMY2Mno3hIZ1s HVGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CQFsAJKS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t3si12150981edq.511.2020.08.17.21.13.34; Mon, 17 Aug 2020 21:14:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CQFsAJKS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726353AbgHREMo (ORCPT + 99 others); Tue, 18 Aug 2020 00:12:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725800AbgHREMn (ORCPT ); Tue, 18 Aug 2020 00:12:43 -0400 Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FB52C061389; Mon, 17 Aug 2020 21:12:42 -0700 (PDT) Received: by mail-qt1-x843.google.com with SMTP id d27so14216543qtg.4; Mon, 17 Aug 2020 21:12:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hXLCDfrcY5+egor1E3ATfAy15D+Z8YefF1V4ZEaEKWs=; b=CQFsAJKSDdLlK3EhRNv8Z+2s7zS5F6umJ9AQlthkXD6FPmHHIHJ0xmjQgnRIDPvjIK LIDlw+c/jKJWU5j81LM7I3qDNXFytBw2i5gCvMP4Luu/00YfE+Sv2TOSFm+i1XaFoXzX MgCZ4zOxi9UlsItvXwDU5pjAT5XzMEJZW/GG50wgPowfpvokDRqPX1D9OY2KAfmt05vA XCu2lRg191aqx42qf9gTZlzPUddGOzGpHTVJrz7v4eX7lKb//h7JqmBHmbDaf04Bq+9G PkXqIwAVE73e+Uz4y4T/w/JXFyENAzMhvah3QTgZb9FZu6sE9fgt4RUo1cRQVv306KDo 1pgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hXLCDfrcY5+egor1E3ATfAy15D+Z8YefF1V4ZEaEKWs=; b=XL5OOhsGRXgQ7ZFBwvIgG1FqiaEpVcfoRc4BGfA4Tjnt/Mf3eDdwNX52NOQ+KrcIVM bEAkwV7xE7vXPI5xCn3CASYU+EsDhVflFbSBetQ797RNwtlowqQN01MhIqpHgGdEnOHL +PX0WcFQO6Cx+1cUD3+/OA0NSkRicJeuthuNP3ZfiMHtxos3yDDjVhiTLSAvLcLHxTNV MwGbY1C2HwdcHj0DBdWYf3Jep26nxgocwqdN3q262AGvzn0g9f03Ms9XzuO8Z704fCTA JNTsskCMH3ih4aWs8NCw1/Vq1MQWk61IOCLDwpiWlv0eiJV0hGSEjTyZw9sAg5jqeG/h wpTw== X-Gm-Message-State: AOAM533aCpDvdlY5ARSJUXRx5iCuxZb3XktkwJqeEpXqtAPQS+xBpE1j d0v5Mn8aXcFAPb2fy7V6LvIX/VIo/TsBqQ== X-Received: by 2002:ac8:4519:: with SMTP id q25mr16754352qtn.29.1597723961327; Mon, 17 Aug 2020 21:12:41 -0700 (PDT) Received: from magi.myfiosgateway.com (pool-173-75-208-99.phlapa.fios.verizon.net. [173.75.208.99]) by smtp.gmail.com with ESMTPSA id i65sm19592212qkf.126.2020.08.17.21.12.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 21:12:40 -0700 (PDT) From: Brooke Basile To: danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com, axboe@kernel.dk Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Brooke Basile Subject: [PATCH] block: rnbd: rnbd-srv: silence uninitialized variable warning Date: Tue, 18 Aug 2020 00:03:18 -0400 Message-Id: <20200818040317.5926-1-brookebasile@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clang warns: drivers/block/rnbd/rnbd-srv.c:150:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (IS_ERR(bio)) { ^~~~~~~~~~~ drivers/block/rnbd/rnbd-srv.c:177:9: note: uninitialized use occurs here return err; ^~~ drivers/block/rnbd/rnbd-srv.c:126:9: note: initialize the variable 'err' to silence this warning int err; ^ = 0 Silence this by replacing `err` with `ret`, returning ret = 0 upon success. Signed-off-by: Brooke Basile --- drivers/block/rnbd/rnbd-srv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c index 0fb94843a495..f515d1a048a9 100644 --- a/drivers/block/rnbd/rnbd-srv.c +++ b/drivers/block/rnbd/rnbd-srv.c @@ -123,10 +123,10 @@ static int process_rdma(struct rtrs_srv *sess, struct rnbd_io_private *priv; struct rnbd_srv_sess_dev *sess_dev; u32 dev_id; - int err; struct rnbd_dev_blk_io *io; struct bio *bio; short prio; + int ret = 0; priv = kmalloc(sizeof(*priv), GFP_KERNEL); if (!priv) @@ -138,7 +138,7 @@ static int process_rdma(struct rtrs_srv *sess, if (IS_ERR(sess_dev)) { pr_err_ratelimited("Got I/O request on session %s for unknown device id %d\n", srv_sess->sessname, dev_id); - err = -ENOTCONN; + ret = -ENOTCONN; goto err; } @@ -168,13 +168,13 @@ static int process_rdma(struct rtrs_srv *sess, submit_bio(bio); - return 0; + return ret; sess_dev_put: rnbd_put_sess_dev(sess_dev); err: kfree(priv); - return err; + return ret; } static void destroy_device(struct rnbd_srv_dev *dev) -- 2.28.0