From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79DB3C433EF for ; Fri, 18 Feb 2022 16:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238111AbiBRQ4Q (ORCPT ); Fri, 18 Feb 2022 11:56:16 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238105AbiBRQ4O (ORCPT ); Fri, 18 Feb 2022 11:56:14 -0500 Received: from mail-oo1-xc2e.google.com (mail-oo1-xc2e.google.com [IPv6:2607:f8b0:4864:20::c2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD79625AE62 for ; Fri, 18 Feb 2022 08:55:57 -0800 (PST) Received: by mail-oo1-xc2e.google.com with SMTP id d134-20020a4a528c000000b00319244f4b04so4162738oob.8 for ; Fri, 18 Feb 2022 08:55:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=pInuhqCUKlyUoEXuWgKg1Wujz7TDTU39Sy2l1F/hTtA=; b=tGMO/mIvCDGbcTb9cGMz11xTh7itxXS7A61+zRdHHfGkwSvgMKZFG21gFAWetvbnZ1 H4bw6eg7/5ZzhaBpDRHoc3nlq1CRQJKgagvK74uAoeHWDDB4PzmwUAfXXEYfMp3lCZdr wbqQtOUtgx3GFlT10yrWbUD3w+oVZWsmqMNZvmJPevYtneBMhxNEFdtDyCDD5L4k6Qrd 1oR6nCDA/xl+K/3EhSi3fDIkSABdaGL9AHY8uJJVRDVE2X1TMyDXNguJ7VmEUWzyReZw pbIl/RGCSJupHY11jktZoCTTDx1y2zABB+9f3bMGIAPErILsRUiqgvXFSZ4otQ+Weboh iGNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=pInuhqCUKlyUoEXuWgKg1Wujz7TDTU39Sy2l1F/hTtA=; b=BB2V5M+ZDjREo+j0c0+VE7pbslC+aNFPJHdkn/Dm8faQx1KfnlqTg+eaF5LwS6+f42 dFzDt2qsGO3bp7iVaYW9ehW2vgl17yLCv6az9q2AK1P/5LLIpqCeb+TgOmliAMbsxhoc 06ZDDP8fCL7bZ7T75jMctcb7XNxLj3CT4v9BgSN8FSZdH67fhgG3EGB4Lim3VIwgTlpL YpFAmmhGkQAiRt0jk0LBEGLQbXBns7gHqILsiWHxXni68i+jHJyXnlN13fQsHVzTX1ar u7ZRF/S3jUpFEibeBNveY4IlcSnDerrKExJwOyd84gBeD0xycdEGxgCbiw0f90XwVYI+ tLMA== X-Gm-Message-State: AOAM532WUBiUcDCL+SJHOtVHT440tJp8ebFoj4pCt236bGW5ZynR0nh5 Xn/jm2ovbRe4V/nMZ9EZmLeKcw== X-Google-Smtp-Source: ABdhPJwMdNlDq+QHL5mKNt87mqwiHbkMztRqQza/VJNIKkYfdAwMNP8R1T6Q3XW6mpT4o1PdTGlfdg== X-Received: by 2002:a05:6870:b003:b0:d1:3804:aee2 with SMTP id y3-20020a056870b00300b000d13804aee2mr2889956oae.155.1645203357235; Fri, 18 Feb 2022 08:55:57 -0800 (PST) Received: from ripper ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id el40sm22088082oab.22.2022.02.18.08.55.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 08:55:56 -0800 (PST) Date: Fri, 18 Feb 2022 08:58:02 -0800 From: Bjorn Andersson To: Doug Anderson Cc: Pavel Machek , Thierry Reding , Uwe Kleine-K?nig , 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 Subject: Re: [PATCH v12 2/2] leds: Add driver for Qualcomm LPG Message-ID: References: <20220216045620.1716537-1-bjorn.andersson@linaro.org> <20220216045620.1716537-2-bjorn.andersson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org On Fri 18 Feb 08:10 PST 2022, Doug Anderson wrote: > 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. You're absolutely correct. I am however not able to figure out how to get my compiler (aarc64 gcc 11.2.0) to give me a warning about this. If anyone have any suggestions I'd be very happy. > 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. > Thanks! I will initialize ret and send out v13 including your T-b. Regards, Bjorn > 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