From patchwork Sun Mar 24 23:18:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kangjie Lu X-Patchwork-Id: 10867781 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8A4D417EF for ; Sun, 24 Mar 2019 23:19:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B2D6290DA for ; Sun, 24 Mar 2019 23:19:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5EB362914A; Sun, 24 Mar 2019 23:19:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04313290DA for ; Sun, 24 Mar 2019 23:19:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729123AbfCXXTF (ORCPT ); Sun, 24 Mar 2019 19:19:05 -0400 Received: from mta-p6.oit.umn.edu ([134.84.196.206]:40914 "EHLO mta-p6.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729069AbfCXXTE (ORCPT ); Sun, 24 Mar 2019 19:19:04 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-p6.oit.umn.edu (Postfix) with ESMTP id 0AECA6A5 for ; Sun, 24 Mar 2019 23:19:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p6.oit.umn.edu ([127.0.0.1]) by localhost (mta-p6.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hXLx69waBPYp for ; Sun, 24 Mar 2019 18:19:02 -0500 (CDT) Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p6.oit.umn.edu (Postfix) with ESMTPS id CB86760F for ; Sun, 24 Mar 2019 18:19:02 -0500 (CDT) Received: by mail-io1-f72.google.com with SMTP id b16so6586636iot.5 for ; Sun, 24 Mar 2019 16:19:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=DF91ha0dMKA4SNjEEqMCAtpvjdqVDKJqxhx+V1bk7ac=; b=KI2/RLEUqprR9I3ac1e06vgceq9vpiWtSsx0rNIfJ0w1Cg16RDmmxxmNSCFS6VbbBp pi4ov761hFS48x7HGV/2o51keAMe+AOREUcFuhlyEH7FrhHmAjqwH0VjLCceDCFcE8Wl q/0f94sgFQHoPT58o0QIjs4I6gLcKN8udcJYXgCP5nQSDW5UaCcSyR96h/WbpgsPWttY bj9T1iaS68titJlWB7vvjY7cvNwtn02EAfOadF2MFehQ7K9p4a523G3GdS3mL+p5EtZ3 YMEjrldZhvkbzOPCeE0xn8esA3hbxSjvTXzwYThrYr/TTwUcThD9ICulbHZ5nKwwUZk8 jokA== 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; bh=DF91ha0dMKA4SNjEEqMCAtpvjdqVDKJqxhx+V1bk7ac=; b=KqKgohNmmCQ1M8kGiGAlPtePcKn0jpNoo8eWDXsc6c6EdD57wZLMRpom4H8QhJ3EYl qs7Lv++MfCe4pTlgDZHxeKV0Rd9WNlzc4sO2y4hD6ZsYwjLyAJjKL7sLP+M3c47S/dXL AzhVSJA+hUZToNGn/Giq/gFjt5wjc65rkvtlNsoiTJUz8B5smaMEBeaArXLIxIvm0efF zK7zGBKtU+KW+kywBgAC+sK4u9gFNm/HUu2EuGjfo30L0X4WZrWnq5ngag9WXkpedO4D MxJfJvJYWd3sMd/3SyYOthePGf88KQIibV/MoqNwBDcX8zxpQIop0EtNOn4wggYMW5TA 8J0w== X-Gm-Message-State: APjAAAUl/6UsyIH0B2m6/FcSW1nUpa+QEkeF4ciOynCceiHamVld2XBC RS5y1liIiupOjmUWsuT4tBCJbZsjTLy7yVu9kcKYP9Mz6p2KN9+4jRs8DgM7gSFI//kcYBiGAX3 rlvuaf/IiVoaRFMKQugkOQWrbNg== X-Received: by 2002:a24:640d:: with SMTP id t13mr9096367itc.38.1553469542276; Sun, 24 Mar 2019 16:19:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFQuXEad+2wsrWluMo+QJPb3mFhvyjTn+307I6YvAJC5ILc62zh4cQPSGe7Xoyiwkmxaa2Kw== X-Received: by 2002:a24:640d:: with SMTP id t13mr9096358itc.38.1553469542100; Sun, 24 Mar 2019 16:19:02 -0700 (PDT) Received: from bee.dtc.umn.edu (cs-bee-u.cs.umn.edu. [128.101.106.63]) by smtp.gmail.com with ESMTPSA id h131sm4948542itb.6.2019.03.24.16.19.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Mar 2019 16:19:01 -0700 (PDT) From: Kangjie Lu To: kjlu@umn.edu Cc: pakki001@umn.edu, Xue Liu , Alexander Aring , Stefan Schmidt , "David S. Miller" , linux-wpan@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: ieee802154: fix missing checks for regmap_update_bits Date: Sun, 24 Mar 2019 18:18:56 -0500 Message-Id: <20190324231856.2664-1-kjlu@umn.edu> X-Mailer: git-send-email 2.17.1 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP regmap_update_bits could fail and deserves a check. The patch adds the checks and if it fails, returns its error code upstream. Signed-off-by: Kangjie Lu Reviewed-by: Mukesh Ojha --- drivers/net/ieee802154/mcr20a.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c index c589f5ae75bb..8bb53ec8d9cf 100644 --- a/drivers/net/ieee802154/mcr20a.c +++ b/drivers/net/ieee802154/mcr20a.c @@ -533,6 +533,8 @@ mcr20a_start(struct ieee802154_hw *hw) dev_dbg(printdev(lp), "no slotted operation\n"); ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL1, DAR_PHY_CTRL1_SLOTTED, 0x0); + if (ret < 0) + return ret; /* enable irq */ enable_irq(lp->spi->irq); @@ -540,11 +542,15 @@ mcr20a_start(struct ieee802154_hw *hw) /* Unmask SEQ interrupt */ ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL2, DAR_PHY_CTRL2_SEQMSK, 0x0); + if (ret < 0) + return ret; /* Start the RX sequence */ dev_dbg(printdev(lp), "start the RX sequence\n"); ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL1, DAR_PHY_CTRL1_XCVSEQ_MASK, MCR20A_XCVSEQ_RX); + if (ret < 0) + return ret; return 0; }