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 13344C433F5 for ; Fri, 18 Feb 2022 16:56:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238107AbiBRQ4R (ORCPT ); Fri, 18 Feb 2022 11:56:17 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238106AbiBRQ4P (ORCPT ); Fri, 18 Feb 2022 11:56:15 -0500 Received: from mail-oo1-xc34.google.com (mail-oo1-xc34.google.com [IPv6:2607:f8b0:4864:20::c34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0B0125AE75 for ; Fri, 18 Feb 2022 08:55:57 -0800 (PST) Received: by mail-oo1-xc34.google.com with SMTP id x6-20020a4a4106000000b003193022319cso4185492ooa.4 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=orUlxBIDrprRl2oZaLxzn/kPRe5GNYZcvyx02DeGiqPihNfwvdz6H8mwAQ+fxvo3Zm CNuedWxx6FtZZsh5KTNAGxdIY06KQJvxptV4uH/16OtUy36jnUeS8DTqngoYfNvjGG7c iNG47i8tksvOvG6dMh3IEwJRLeMUb8ScDNeO9ngp2OIJ9lCoHm2J9fkV05xewDeYi+pB Gb3jSl5914Eow8RaK5dV3gAdSzg9Jk8wcFfB5TNhqWDuYbnMGPSUb6Qst5MF1htCrJ1D mhjVfOzY6U/9LZb9Am6OWzXCYtgEcJWRPHLBoFI6qYCayspajpfAGzYsYWXpDzRztCsP 8Ydw== X-Gm-Message-State: AOAM530loXudWpvAnZP1ijvUcclFHNZK1+6g2RGBOqfttgVNeAoXMtC3 cBeI4MSrR9X3NUkLF+Q6HiG3bA== 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: devicetree@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