Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp877867rdb; Fri, 20 Oct 2023 01:56:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHorJjfRK+2Sbt3K/BcF7HQMRumUdQKqxAevvt2L/AFb9E0Q6gA1qgXXE9p2KtSlzZ7PYmj X-Received: by 2002:a05:6a00:21d1:b0:68a:5cf8:dae4 with SMTP id t17-20020a056a0021d100b0068a5cf8dae4mr1842092pfj.3.1697792177533; Fri, 20 Oct 2023 01:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697792177; cv=none; d=google.com; s=arc-20160816; b=qAQfGgET5NfH8/+2AUZmX29hM2h6DHuPP+R3CKpvTS5jjgM21VUJhFKFvLeVTAgeqV QNuC+Fd0TssYMZ2kxlTutb/UfwoNipmaoG6szOdbTVs57ry37T2mGDrvHR4VHyH4i0lR Tp/d+kqqbyEfj+knZgMKlpGB+C6dCVRxBRBcbIAh8Ma/5GULS/4pbiaQZZlXt+q1sYaU c57w2hCdBFyh67EGkoTGLCQBpo5u8c1Fosjf9l0ZFfDPAE8infVEnVqEbibcntNWEVhW GXA4CusTvuv9UOfFElVrq8YjDbMiFaZ79+hhk6Dh8h7U1z7CogI/HyVe1PootO+Q5ZQ6 ERJg== 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 :message-id:date:subject:cc:to:from; bh=DZIHWyAsI+ZdICZ8/ZNJIx4oer6FzKJzXxQqKqkbnxE=; fh=AJ7l2kObtjS7OO6VO6lwhM9I0svc7z75QDCB1bB0m74=; b=vI/SPnRSu3di8A6Y4ntZR8zDY3H/zaIFzmaVKeMrl/ggUM6agN20M/7XNtlXdM55EC aJ1kxcUthcx/4nouIN8ru4rdp7zsWIxapAkFEPteFhcI2zuHTH1xX84W217MALOWMhaE sZqmEGd1SQzZ3/fYbjjusJyCoGXfb4/0PPeL1O6+KmqigHDkV6NHL07113PO2Ziz4CMa tOTW4i9HAiNicW7CaECRBDjeppBMj0T62LcF2+g6iMRU5sNEhbOxq2yp/Ixarss11T/4 z1TzbuWau6h4d7ujhu9R/xugjU/P4H4vDOaIJPicB7Gjq1lTd6mVUPipl/pU/HTMDGEl BYPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id c66-20020a633545000000b00578f23273a3si1502385pga.738.2023.10.20.01.56.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 01:56:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 35A04825F135; Fri, 20 Oct 2023 01:56:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376555AbjJTIzz (ORCPT + 99 others); Fri, 20 Oct 2023 04:55:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376546AbjJTIzy (ORCPT ); Fri, 20 Oct 2023 04:55:54 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 96248D57; Fri, 20 Oct 2023 01:55:48 -0700 (PDT) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id F1F88604889BB; Fri, 20 Oct 2023 16:55:35 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, jdelvare@suse.com, linux@roeck-us.net, thierry.reding@gmail.com, u.kleine-koenig@pengutronix.de Cc: Su Hui , openbmc@lists.ozlabs.org, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] hwmon: npcm750-pwm: add an error code check in npcm7xx_en_pwm_fan Date: Fri, 20 Oct 2023 16:55:19 +0800 Message-Id: <20231020085518.198477-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 20 Oct 2023 01:56:14 -0700 (PDT) npcm7xx_pwm_config_set() can return '-ENODEV' for failed. So check the value of 'ret' after calling npcm7xx_pwm_config_set(). Signed-off-by: Su Hui --- drivers/hwmon/npcm750-pwm-fan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hwmon/npcm750-pwm-fan.c b/drivers/hwmon/npcm750-pwm-fan.c index 10ed3f4335d4..4702e4edc662 100644 --- a/drivers/hwmon/npcm750-pwm-fan.c +++ b/drivers/hwmon/npcm750-pwm-fan.c @@ -875,6 +875,8 @@ static int npcm7xx_en_pwm_fan(struct device *dev, data->pwm_present[pwm_port] = true; ret = npcm7xx_pwm_config_set(data, pwm_port, NPCM7XX_PWM_CMR_DEFAULT_NUM); + if (ret) + return ret; ret = of_property_count_u8_elems(child, "cooling-levels"); if (ret > 0) { -- 2.30.2