From patchwork Tue Apr 23 16:13:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Stark X-Patchwork-Id: 13640330 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5D461C4345F for ; Tue, 23 Apr 2024 16:14:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FuT8NHM6tokD9SatBx2DjUqiwQtQTyGowR8QIra74R8=; b=Ec5XWggfT6jH// k5GPMjjDXXbSurzY9Lh5et+qrucDaGEgaCYSVODmqNdSpmNNLVUt9oAICOkyMt/hrQPD66DzIzO5U SuDHCMUHB1Ya9v0DYmRuqruTCLOTpHHJDK8izwJ/I50pQuabVVooU41W1F0pw+yAxTYg16uLqCMTj /E4EGwwtfe6LfCJ8BU5bOoVOzOsMtYsdYf5yF6OIy3pqW9SRNtTSOWVpmHM0DVXDSkawrghAEzBn/ DAXkqwi1rVug8MCfy8sUw68z/SeQ+UZ1KUsR9JcbIPjLQTQTAis2FU5XqUiNZnwPkQ+qye7ZT5/vR Hkaz/EWtB8KvGTbgm29g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzImw-00000000gRz-147N; Tue, 23 Apr 2024 16:14:34 +0000 Received: from mx1.sberdevices.ru ([37.18.73.165]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzImV-00000000gAP-1OIY; Tue, 23 Apr 2024 16:14:09 +0000 Received: from p-infra-ksmg-sc-msk01 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id F38FC10000F; Tue, 23 Apr 2024 19:14:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru F38FC10000F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salutedevices.com; s=mail; t=1713888844; bh=Eb7vuPSuYnLMwuwGHzpqpt0wDC94w7XsXp1ME5MdeHM=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=rAWXG9MTkFJR8xM9NJQegShLU8uEwEu2YxwpPSX4u4ccFgdSmtiPJAtZepxmV0flQ 2NIuYWF5/eZs3NadRRTTBcvvA5MA5TuOcRxLzUpcZxZEipGMIoUgZEzETKcVo+6jSs 96ODG7/fU44CEaWDjdxp1cgI6tkeIWja2uDjeQgeM0MyBuG+ZQEL0L7Y44kmCafL3s tuTWRVPFa4M4Oi6vo1wlmE+bMScl5Y732jQJfYcMFjtmtHb3n80+PxPB44vaYMK8/j kXe23Yx/LSUFxxxIRfBM/5OP0dUIrqgFO27JPQlck7A3CHpDd+ebwrj8wiCnMHmKJq 156PXjxde7AxA== Received: from smtp.sberdevices.ru (p-i-exch-sc-m02.sberdevices.ru [172.16.192.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Tue, 23 Apr 2024 19:14:04 +0300 (MSK) Received: from work.sberdevices.ru (100.64.160.123) by p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 23 Apr 2024 19:14:04 +0300 From: George Stark To: , , , , , , CC: , , , , , George Stark , Dmitry Rokosov Subject: [PATCH 1/2] pwm: meson: drop unneeded check in get_state callback Date: Tue, 23 Apr 2024 19:13:55 +0300 Message-ID: <20240423161356.2522636-2-gnstark@salutedevices.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240423161356.2522636-1-gnstark@salutedevices.com> References: <20240423161356.2522636-1-gnstark@salutedevices.com> MIME-Version: 1.0 X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) To p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 184882 [Apr 23 2024] X-KSMG-AntiSpam-Version: 6.1.0.4 X-KSMG-AntiSpam-Envelope-From: gnstark@salutedevices.com X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 18 0.3.18 b9d6ada76958f07c6a68617a7ac8df800bc4166c, {Tracking_from_domain_doesnt_match_to}, salutedevices.com:7.1.1;100.64.160.123:7.1.2;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;127.0.0.199:7.1.2;smtp.sberdevices.ru:7.1.1,5.0.1, FromAlignment: s, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2024/04/23 04:11:00 #24934400 X-KSMG-AntiVirus-Status: Clean, skipped X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_091407_832608_60026D84 X-CRM114-Status: GOOD ( 10.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Drop checking state argument for null pointer in meson_pwm_get_state() due to it is called only from pwm core with always valid arguments. Fixes: 211ed630753d ("pwm: Add support for Meson PWM Controller") Signed-off-by: George Stark Signed-off-by: Dmitry Rokosov --- drivers/pwm/pwm-meson.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index 529a541ba7b6..ebe76298f6e2 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -311,9 +311,6 @@ static int meson_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, struct meson_pwm_channel *channel; u32 value; - if (!state) - return 0; - channel = &meson->channels[pwm->hwpwm]; channel_data = &meson_pwm_per_channel_data[pwm->hwpwm]; From patchwork Tue Apr 23 16:13:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Stark X-Patchwork-Id: 13640329 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1F044C04FFE for ; Tue, 23 Apr 2024 16:14:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SxA7OotsrhYf1NVDIzCM++MYD4YiCecUXbl5dk95dAI=; b=AgYxTASZtqgsxp EMnnWhpyzfnJT3K9PWDWBtsuxfXLNqcjBRPmVDil97FVmQf0pp+xvKTmankN/Na59fmb9y9GoiAUw lLWIpvJT0LvldSsK1QtNjXas1zFx3TPRZZvnIuie8PpaJIVcSJH6vRJ+cDVDKzzl55D+Dx7IqmQAq NF0l+8zt8h4kwVAbCJxfJqCHPiVSExviKS/YO26SyBxL4iK/9GOYIp9vY5v7ztiQPWNUnVK7IyM+4 vQW14jMk0x82vAluF9IkSZ6Maq/p705a+1B6HAzOb0oWx3IEfb2qGzXBXtzTJs7MCDdbl5xEl8hlO R+ha4dNJM8osM3R4C+Bg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzImb-00000000gDk-0a4u; Tue, 23 Apr 2024 16:14:13 +0000 Received: from mx2.sberdevices.ru ([45.89.224.132] helo=mx1.sberdevices.ru) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzImV-00000000gAX-0nvy; Tue, 23 Apr 2024 16:14:08 +0000 Received: from p-infra-ksmg-sc-msk02 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id 43D96120011; Tue, 23 Apr 2024 19:14:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru 43D96120011 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salutedevices.com; s=mail; t=1713888845; bh=5Gfs5AmZGozZkrrRTvm140Edujqw0V5kNp9waYflDF8=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=b1yJeJJaDHqH69ss+sRunhyufYQj7rb6mouCKXrVFaysnuFWc1mTSgT1EdKNU6Pq3 A79gQ+iFnbkN0Ik2WngcXBxeoU35rNHzUXQh3IOuRagb9hDzpBNxo+53kX7rrwtmFf yXSumzqbDzwQ4ffX1nb0oatFzMSYX461Wf41TP6vjjzW0ATntFn5grKADVJzfDfkmB VL3FO6D8MQTQXABxWmID518Txl7ELHqLvPC32mgKsIqlp6xu42EYxFxDIVbedXbA9b zlbsYkG4x9qmvprIbIh5ASsZ7oDjF+OW43b3OLIzQ6ac+CLmxuPZq+U3u2b8O0GYP1 QGCVfVjuwnZ2w== Received: from smtp.sberdevices.ru (p-i-exch-sc-m02.sberdevices.ru [172.16.192.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Tue, 23 Apr 2024 19:14:05 +0300 (MSK) Received: from work.sberdevices.ru (100.64.160.123) by p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 23 Apr 2024 19:14:04 +0300 From: George Stark To: , , , , , , CC: , , , , , George Stark , Dmitry Rokosov Subject: [PATCH 2/2] pwm: meson: add check for error from clk_round_rate() Date: Tue, 23 Apr 2024 19:13:56 +0300 Message-ID: <20240423161356.2522636-3-gnstark@salutedevices.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240423161356.2522636-1-gnstark@salutedevices.com> References: <20240423161356.2522636-1-gnstark@salutedevices.com> MIME-Version: 1.0 X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) To p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 184882 [Apr 23 2024] X-KSMG-AntiSpam-Version: 6.1.0.4 X-KSMG-AntiSpam-Envelope-From: gnstark@salutedevices.com X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 18 0.3.18 b9d6ada76958f07c6a68617a7ac8df800bc4166c, {Tracking_from_domain_doesnt_match_to}, salutedevices.com:7.1.1;100.64.160.123:7.1.2;smtp.sberdevices.ru:7.1.1,5.0.1;127.0.0.199:7.1.2;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1, FromAlignment: s, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2024/04/23 04:11:00 #24934400 X-KSMG-AntiVirus-Status: Clean, skipped X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_091407_641285_B9591CF3 X-CRM114-Status: GOOD ( 12.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org clk_round_rate() can return not only zero if requested frequency can not be provided but also negative error code so add check for it too. Fixes: 329db102a26d ("pwm: meson: make full use of common clock framework") Signed-off-by: George Stark Signed-off-by: Dmitry Rokosov --- drivers/pwm/pwm-meson.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index ebe76298f6e2..52604635b31e 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -168,9 +168,10 @@ static int meson_pwm_calc(struct pwm_chip *chip, struct pwm_device *pwm, freq = ULONG_MAX; fin_freq = clk_round_rate(channel->clk, freq); - if (fin_freq == 0) { - dev_err(pwmchip_parent(chip), "invalid source clock frequency\n"); - return -EINVAL; + if (fin_freq <= 0) { + dev_err(pwmchip_parent(chip), + "invalid source clock frequency %llu\n", freq); + return fin_freq ? fin_freq : -EINVAL; } dev_dbg(pwmchip_parent(chip), "fin_freq: %lu Hz\n", fin_freq);