Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9132347pxu; Mon, 28 Dec 2020 07:25:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/waefLNqzKDxuCQXMQoBmJbLSptY1gTm8mpustlbosx7Ddws+72ri7Jd4Klqck2EUAPah X-Received: by 2002:a17:906:8058:: with SMTP id x24mr40360289ejw.262.1609169114918; Mon, 28 Dec 2020 07:25:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609169114; cv=none; d=google.com; s=arc-20160816; b=PqEtcUQ0ZCdLZjhOy0I+xgoQP3dUXIAOJSaFtXMPY8HRAfbOeWgwlt9F82HYwHKos+ ev/q80HsVxiL1NNFWFN7LCgMCFXKPlMpoBBcxdwhBHAdw17cb4UslSbZLDVlR3L5IB3Z 6yiu4xxTpwgRHkBvs9ov9MZS1px0KZl9pughoWqsInesR2HS3fn6QwJrcvTObyC2Yxrt QbW9Cz9NIEPPhDNe2+mmz55MQkZ6X/v/oDlIui3XxeN7BACvThISUCL0zK/kCdI2Pv2g VcPh5quSL6BwtLML9JowlWWvBAZE+3JZU+2aNdvqJlLrk/dsoBrWloI1aE7EiUp3oYmA iZxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=r3DhLHBZIQ/B0eeE+8v/Ua/lOk56wLZcfSogJMT5IHc=; b=feynMH2g8di0pBKCCktE37v2jbBAIBWaCEYn14UNrCQeEUD1C4iKsK6+ewIv5tajKd +1SQDvIhwVOn/VSMS7P04qdeQc+7OCCzxRU+BleIHIUwNT2VBQGBbuzBDidqSZ8/PhqN 39MmnQJutk6jzAURi4iQ6Ow1T2pf17b7Cxdano+izPLBi5IBZ1EkQiR4CGiBuBCkSfhl tNCuJS/TNJjsakUMYH1IJdOLUIhFteQBmhJ0mat975apegKnlu+VJX8cWn+4wu0dFDjO Ey2dSGqpq1CCLZH/kqHje+0nQCmPWIdlD7n+BJoxDZ2RFpqmg6PL9qnzh0reB15XbwCs BO3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2AKpAYIm; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a23si20412618edn.292.2020.12.28.07.24.51; Mon, 28 Dec 2020 07:25:14 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=2AKpAYIm; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2440872AbgL1PWq (ORCPT + 99 others); Mon, 28 Dec 2020 10:22:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:35002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391653AbgL1OBX (ORCPT ); Mon, 28 Dec 2020 09:01:23 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 646C120731; Mon, 28 Dec 2020 14:01:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164068; bh=GL+21FBX3yzsX00iEmSsGaFo8GODJAxDZ6ieMWTpDhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2AKpAYImsGm1lzhQ2+pnKxCUCwjHkPkz4h+sl8mL8dTEKUZHI6+obo6S7ieAprwnU OpqdgSJ7+RKF+Kl1OESqztTcKtUY11p0GbzjajjPpPXvxVKpJ11AIKdP1f8+4JVFdE k96lhfSAY6bLuWTLoIpHrP5OttDEWKaB7xhVos4M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Alexandre Belloni , Sasha Levin Subject: [PATCH 5.10 017/717] rtc: pcf2127: fix pcf2127_nvmem_read/write() returns Date: Mon, 28 Dec 2020 13:40:15 +0100 Message-Id: <20201228125021.808913081@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit ba1c30bf3f2536f248d262c6f257b5a787305991 ] These functions should return zero on success. Non-zero returns are treated as error. On some paths, this doesn't matter but in nvmem_cell_read() a non-zero return would be passed to ERR_PTR() and lead to an Oops. Fixes: d6c3029f32f7 ("rtc: pcf2127: add support for accessing internal static RAM") Signed-off-by: Dan Carpenter Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/20201022070451.GA2817669@mwanda Signed-off-by: Sasha Levin --- drivers/rtc/rtc-pcf2127.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c index 07a5630ec841f..4d9711d51f8f3 100644 --- a/drivers/rtc/rtc-pcf2127.c +++ b/drivers/rtc/rtc-pcf2127.c @@ -243,10 +243,8 @@ static int pcf2127_nvmem_read(void *priv, unsigned int offset, if (ret) return ret; - ret = regmap_bulk_read(pcf2127->regmap, PCF2127_REG_RAM_RD_CMD, - val, bytes); - - return ret ?: bytes; + return regmap_bulk_read(pcf2127->regmap, PCF2127_REG_RAM_RD_CMD, + val, bytes); } static int pcf2127_nvmem_write(void *priv, unsigned int offset, @@ -261,10 +259,8 @@ static int pcf2127_nvmem_write(void *priv, unsigned int offset, if (ret) return ret; - ret = regmap_bulk_write(pcf2127->regmap, PCF2127_REG_RAM_WRT_CMD, - val, bytes); - - return ret ?: bytes; + return regmap_bulk_write(pcf2127->regmap, PCF2127_REG_RAM_WRT_CMD, + val, bytes); } /* watchdog driver */ -- 2.27.0