Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp2997948pxb; Sun, 20 Feb 2022 06:35:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxrbnLdvVYKtVTkrmGQ8WTAI5wsR4C8ngMyhxKpMkmm4hS7TJD5xK78hVmxFjoaaCuZYFbU X-Received: by 2002:a17:907:1a48:b0:6ce:4aa:30c5 with SMTP id mf8-20020a1709071a4800b006ce04aa30c5mr12821083ejc.559.1645367707715; Sun, 20 Feb 2022 06:35:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645367707; cv=none; d=google.com; s=arc-20160816; b=xCN5kpUaNu7+O8JpFYK8TU/B/7Xvywe9laNR9Hsz0jA57EDMCABQ+Pm2ScMQtqKVAI Me0PCpi0JSLrpA87DYr6MSef2AGPmsQSGMZTbHlTM3xgtNd+VC4VS8orHJs+6z63Ifiu Dbpio6ZRIGi8CFmQwZb8Yl1a0wH76TZ2vllWXDxTive9u2bi+Q7Tp0RK9zJI1HAQ3cMM nsYHbPLPJiHxWOFBAUxhLTCzBnMkhYNztNt/VcJvfjcWOPcXklne1BKEGLdJXWCICsUO YJOBYyIoqvHpkmNPNGriVywIfxNtn48YlZwW0EMlTtLYgNT5T5Tb/7OQ0QatXUmOWiU7 Dt3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=A2OloDpJvsjdWi7wGdly9G9Fl4hNwVdVhIAytmuuXRs=; b=KT76T3CXCOOIxO+cabyiIQ0iNrN37vYQ/9pnUBgRn6ssEOLmkhTQu7eSfhilkBmAlI yOrErpyMOcZ8N2+x39FmvsHcBJXNmI3FZmiXp6ihffNSqcxw3Gld0p29g1X9e2leVeHf v233xoEea+8esrYLJM6weTb0FYehCZ+jtvNJamJBVARM2n32lpUflq33RcFjciuy8P6u 4moZ0wuNUyatWuEiWU/tFy/62oehgvqNGgYN5E/7AKA6ZfN6wxapm8IDl49MUtjb3hLm MPU+u1iQigbKDcDLJ1v4NcTMGPzeIuZiTbG0F4jZTX9SzKlIa2bYSYX6DVrpSRlwmzsf aaXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=EkJRBZvS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 27si6529339eja.324.2022.02.20.06.34.44; Sun, 20 Feb 2022 06:35:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=EkJRBZvS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237444AbiBRQL1 (ORCPT + 99 others); Fri, 18 Feb 2022 11:11:27 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237454AbiBRQLY (ORCPT ); Fri, 18 Feb 2022 11:11:24 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27D5C229E75 for ; Fri, 18 Feb 2022 08:11:07 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id p15so16121174ejc.7 for ; Fri, 18 Feb 2022 08:11:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=A2OloDpJvsjdWi7wGdly9G9Fl4hNwVdVhIAytmuuXRs=; b=EkJRBZvSnj9R4IxbhdruXGy1aYW2yS2ue39KyFuXYWoUHS8yMXNEtcICUEj45dcK7D Ju1waEUm5V22tInwgU0e5alziJzVuCyDNowFFx/G8WGjFod0Jk+kODbiGWAn11xCkIY6 Nb4cJq6//pZhbOaTWDt3uiAOK54AuW1bKNcUE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=A2OloDpJvsjdWi7wGdly9G9Fl4hNwVdVhIAytmuuXRs=; b=40Y7lgzNdjttItfcgO5rhUZRNmamtpB1sqANLoIQ49sPyt8MiSjmal9SJroVMhSA46 laU3QX4YKHcQQtyqsdoyf2TR+eK/kPdNuiDfVDcWqdDxzpfki3xa1fQ3/h0XNB0jb3RM XGdkA9ihr17gxzaTZmj3nD3oKTPf4wv0jjJTcuNipVC2x2lBzpDF3aaNXXvCVa1FvwVf zi2t4mYZxRnLj+yxeNTiSk5L2gIXsI/mQk/O4WKOJzAx7el8Q0sG+pOEGUtKzxxpUST5 tV6Au8QhFORVRXKPLhEuYFyD2KeJJzVcKVXpm1K8mytpc9/+QnSYwCaVNR4LixKs6npB B6WQ== X-Gm-Message-State: AOAM531pM0TMj0E4EFOZzxzEWaWbxed/P7UKPZJMyvDfYvHFYtKoOfdd iIVfaYp2ZM/mVtNgmeeXByY0pm8Dt9nIOz01f0I= X-Received: by 2002:a17:907:954f:b0:6ad:3614:73e6 with SMTP id ex15-20020a170907954f00b006ad361473e6mr7110455ejc.731.1645200665365; Fri, 18 Feb 2022 08:11:05 -0800 (PST) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com. [209.85.221.47]) by smtp.gmail.com with ESMTPSA id i28sm2425652ejo.49.2022.02.18.08.11.03 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 18 Feb 2022 08:11:04 -0800 (PST) Received: by mail-wr1-f47.google.com with SMTP id f3so15248492wrh.7 for ; Fri, 18 Feb 2022 08:11:03 -0800 (PST) X-Received: by 2002:adf:ef07:0:b0:1e3:333f:a101 with SMTP id e7-20020adfef07000000b001e3333fa101mr6712804wro.301.1645200663316; Fri, 18 Feb 2022 08:11:03 -0800 (PST) MIME-Version: 1.0 References: <20220216045620.1716537-1-bjorn.andersson@linaro.org> <20220216045620.1716537-2-bjorn.andersson@linaro.org> In-Reply-To: <20220216045620.1716537-2-bjorn.andersson@linaro.org> From: Doug Anderson Date: Fri, 18 Feb 2022 08:10:50 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v12 2/2] leds: Add driver for Qualcomm LPG To: Bjorn Andersson Cc: Pavel Machek , Thierry Reding , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Lee Jones , Satya Priya Kakitapalli , Marijn Suijten , Luca Weiss , Rob Herring , linux-leds@vger.kernel.org, "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , LKML , linux-pwm Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Tue, Feb 15, 2022 at 8:54 PM Bjorn Andersson wrote: > > +static int lpg_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, > + const struct pwm_state *state) > +{ > + struct lpg *lpg = container_of(chip, struct lpg, pwm); > + struct lpg_channel *chan = &lpg->channels[pwm->hwpwm]; > + int ret; > + > + if (state->polarity != PWM_POLARITY_NORMAL) > + return -EINVAL; > + > + mutex_lock(&lpg->lock); > + > + if (state->enabled) { > + ret = lpg_calc_freq(chan, state->period); > + if (ret < 0) > + goto out_unlock; > + > + lpg_calc_duty(chan, state->duty_cycle); > + } > + chan->enabled = state->enabled; > + > + lpg_apply(chan); > + > + triled_set(lpg, chan->triled_mask, chan->enabled ? chan->triled_mask : 0); > + > +out_unlock: > + mutex_unlock(&lpg->lock); > + > + return ret; > +} My compiler (correctly) yelled that `ret` is returned uninitialized if `state->enabled` is false. I initialized `ret` to 0 and the problem went away. I assume that the patch will need to spin to fix that unless everything else looks great and a maintainer wants to fix that when applying. With that fix, I was able to use Bjorn's patch along with Satya's patches adding pm8350c support (removing the now defunct "pwm_9bit_mask" property) to make the PWM on my board work. Thus, once the error my compiler complained about is fixed I'm happy with my `Tested-by` being added. For now I haven't actually reviewed the code here, but if folks feel like it needs an extra pair of eyes then please yell and I'll find some time to do it. -Doug