mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: "Miclaus, Antoniu" <Antoniu.Miclaus@analog.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	"Hennerich, Michael" <Michael.Hennerich@analog.com>,
	Jonathan Cameron <jic23@kernel.org>,
	David Lechner <dlechner@baylibre.com>,
	"Sa, Nuno" <Nuno.Sa@analog.com>,
	Andy Shevchenko <andy@kernel.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4] iio: frequency: admv1013: fix NULL pointer dereference on str
Date: Thu, 5 Mar 2026 11:51:51 +0200	[thread overview]
Message-ID: <aalSN21HiRi9g8x6@ashevche-desk.local> (raw)
In-Reply-To: <CY4PR03MB3399F7FB4FE82A606CCC333D9B7DA@CY4PR03MB3399.namprd03.prod.outlook.com>

On Thu, Mar 05, 2026 at 09:44:35AM +0000, Miclaus, Antoniu wrote:
> > -----Original Message-----
> > From: Andy Shevchenko <andy.shevchenko@gmail.com>
> > Sent: Thursday, March 5, 2026 11:36 AM
> > On Thu, Mar 5, 2026 at 11:15 AM Antoniu Miclaus
> > <antoniu.miclaus@analog.com> wrote:

...

> > > static int admv1013_init(struct admv1013_state *st, int vcm_uv)
> > 
> > > -       data = FIELD_PREP(ADMV1013_QUAD_SE_MODE_MSK, st-
> > >quad_se_mode);
> > > +       switch (st->quad_se_mode) {
> > > +       case ADMV1013_SE_MODE_POS:
> > > +               data = 6;
> > > +               break;
> > > +       case ADMV1013_SE_MODE_NEG:
> > > +               data = 9;
> > > +               break;
> > > +       case ADMV1013_SE_MODE_DIFF:
> > > +               data = 12;
> > > +               break;
> > > +       default:
> > > +               return -EINVAL;
> > > +       }
> > 
> > Oh, I haven't realised that it can be done like this. I have in mind
> > just to have a switch in the probe, so we don't need to do that again
> > and again. Otherwise looks good to me.
> 
> Hmm, the _init() function is called only in the probe.

Ah, missed that. Then we are good.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

> I think it makes a bit more sense to be here where we handle all the initial
> register configurations.

Agree.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-03-05  9:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05  9:14 Antoniu Miclaus
2026-03-05  9:35 ` Andy Shevchenko
2026-03-05  9:44   ` Miclaus, Antoniu
2026-03-05  9:51     ` Andy Shevchenko [this message]
2026-03-07 12:11       ` Jonathan Cameron

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=aalSN21HiRi9g8x6@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=Antoniu.Miclaus@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=Nuno.Sa@analog.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®