All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: [linux-next:master 8752/11953] sound/soc/codecs/lpass-macro-common.c:53 lpass_macro_pds_init() warn: passing zero to 'ERR_PTR'
Date: Tue, 22 Mar 2022 17:09:31 +0300	[thread overview]
Message-ID: <20220322140931.GW336@kadam> (raw)
In-Reply-To: <b4d712ea-ba66-81a6-8cb5-180b5e6f8123@quicinc.com>

[-- Attachment #1: Type: text/plain, Size: 1867 bytes --]

On Tue, Mar 22, 2022 at 07:32:16PM +0530, Srinivasa Rao Mandadapu wrote:
> 
> On 3/22/2022 7:24 PM, Dan Carpenter wrote:
> Thanks for Your Time Dan!!!
> > On Tue, Mar 22, 2022 at 07:03:23PM +0530, Srinivasa Rao Mandadapu wrote:
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  14  struct lpass_macro *lpass_macro_pds_init(struct device *dev)
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  15  {
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  16  	struct lpass_macro *l_pds;
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  17  	int ret;
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  18
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  19  	if (!of_find_property(dev->of_node, "power-domains", NULL))
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  20  		return NULL;
> > > > 
> > > > Returning NULL here will lead to a crash in tx_macro_runtime_resume()
> > > > 
> > > > When a function returns a mix of NULL and error pointers, then NULL
> > > > means the feature is deliberately disabled.  It's not an error, it's a
> > > > deliberate choice by the distro or sys admin.  The caller has to
> > > > be written to allow the feature to be disabled.
> > > > 
> > > > An example of this might be LEDs.  Maybe people don't want LEDs so code
> > > > has to asume that the led->ops pointer might be NULL and check for that
> > > > before dereferencing it.
> > > Actually, it's optional here. For some targets, with lpass ADSP enabled,
> > > power domains are not required.
> > > 
> > > So is the reason, returning NULL Here.
> > > 
> > Unfortunately, the caller is not written to handle NULLs so it will
> > crash.
> 
> Yes agree. will add error check with in lpass_macro_pds_exit().
> 
> Will that make sense?

Yep.  Thanks!

regards,
dan carpenter

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [linux-next:master 8752/11953] sound/soc/codecs/lpass-macro-common.c:53 lpass_macro_pds_init() warn: passing zero to 'ERR_PTR'
Date: Tue, 22 Mar 2022 17:09:31 +0300	[thread overview]
Message-ID: <20220322140931.GW336@kadam> (raw)
In-Reply-To: <b4d712ea-ba66-81a6-8cb5-180b5e6f8123@quicinc.com>

[-- Attachment #1: Type: text/plain, Size: 1867 bytes --]

On Tue, Mar 22, 2022 at 07:32:16PM +0530, Srinivasa Rao Mandadapu wrote:
> 
> On 3/22/2022 7:24 PM, Dan Carpenter wrote:
> Thanks for Your Time Dan!!!
> > On Tue, Mar 22, 2022 at 07:03:23PM +0530, Srinivasa Rao Mandadapu wrote:
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  14  struct lpass_macro *lpass_macro_pds_init(struct device *dev)
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  15  {
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  16  	struct lpass_macro *l_pds;
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  17  	int ret;
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  18
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  19  	if (!of_find_property(dev->of_node, "power-domains", NULL))
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  20  		return NULL;
> > > > 
> > > > Returning NULL here will lead to a crash in tx_macro_runtime_resume()
> > > > 
> > > > When a function returns a mix of NULL and error pointers, then NULL
> > > > means the feature is deliberately disabled.  It's not an error, it's a
> > > > deliberate choice by the distro or sys admin.  The caller has to
> > > > be written to allow the feature to be disabled.
> > > > 
> > > > An example of this might be LEDs.  Maybe people don't want LEDs so code
> > > > has to asume that the led->ops pointer might be NULL and check for that
> > > > before dereferencing it.
> > > Actually, it's optional here. For some targets, with lpass ADSP enabled,
> > > power domains are not required.
> > > 
> > > So is the reason, returning NULL Here.
> > > 
> > Unfortunately, the caller is not written to handle NULLs so it will
> > crash.
> 
> Yes agree. will add error check with in lpass_macro_pds_exit().
> 
> Will that make sense?

Yep.  Thanks!

regards,
dan carpenter

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Cc: kbuild@lists.01.org, lkp@intel.com, kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>,
	Mark Brown <broonie@kernel.org>,
	Venkata Prasad Potturu <quic_potturu@quicinc.com>
Subject: Re: [linux-next:master 8752/11953] sound/soc/codecs/lpass-macro-common.c:53 lpass_macro_pds_init() warn: passing zero to 'ERR_PTR'
Date: Tue, 22 Mar 2022 17:09:31 +0300	[thread overview]
Message-ID: <20220322140931.GW336@kadam> (raw)
In-Reply-To: <b4d712ea-ba66-81a6-8cb5-180b5e6f8123@quicinc.com>

On Tue, Mar 22, 2022 at 07:32:16PM +0530, Srinivasa Rao Mandadapu wrote:
> 
> On 3/22/2022 7:24 PM, Dan Carpenter wrote:
> Thanks for Your Time Dan!!!
> > On Tue, Mar 22, 2022 at 07:03:23PM +0530, Srinivasa Rao Mandadapu wrote:
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  14  struct lpass_macro *lpass_macro_pds_init(struct device *dev)
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  15  {
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  16  	struct lpass_macro *l_pds;
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  17  	int ret;
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  18
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  19  	if (!of_find_property(dev->of_node, "power-domains", NULL))
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  20  		return NULL;
> > > > 
> > > > Returning NULL here will lead to a crash in tx_macro_runtime_resume()
> > > > 
> > > > When a function returns a mix of NULL and error pointers, then NULL
> > > > means the feature is deliberately disabled.  It's not an error, it's a
> > > > deliberate choice by the distro or sys admin.  The caller has to
> > > > be written to allow the feature to be disabled.
> > > > 
> > > > An example of this might be LEDs.  Maybe people don't want LEDs so code
> > > > has to asume that the led->ops pointer might be NULL and check for that
> > > > before dereferencing it.
> > > Actually, it's optional here. For some targets, with lpass ADSP enabled,
> > > power domains are not required.
> > > 
> > > So is the reason, returning NULL Here.
> > > 
> > Unfortunately, the caller is not written to handle NULLs so it will
> > crash.
> 
> Yes agree. will add error check with in lpass_macro_pds_exit().
> 
> Will that make sense?

Yep.  Thanks!

regards,
dan carpenter



  reply	other threads:[~2022-03-22 14:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11  9:47 [linux-next:master 8752/11953] sound/soc/codecs/lpass-macro-common.c:53 lpass_macro_pds_init() warn: passing zero to 'ERR_PTR' kernel test robot
2022-03-11 11:53 ` Dan Carpenter
2022-03-11 11:53 ` Dan Carpenter
2022-03-22 13:33 ` Srinivasa Rao Mandadapu
2022-03-22 13:33   ` Srinivasa Rao Mandadapu
2022-03-22 13:54   ` Dan Carpenter
2022-03-22 13:54     ` Dan Carpenter
2022-03-22 13:54     ` Dan Carpenter
2022-03-22 14:02     ` Srinivasa Rao Mandadapu
2022-03-22 14:02       ` Srinivasa Rao Mandadapu
2022-03-22 14:09       ` Dan Carpenter [this message]
2022-03-22 14:09         ` Dan Carpenter
2022-03-22 14:09         ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220322140931.GW336@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.