OSDN Git Service

block: sed-opal: pass steps via argument rather than via opal_dev
authorDavid Kozub <zub@linux.fjfi.cvut.cz>
Thu, 14 Feb 2019 00:16:06 +0000 (01:16 +0100)
committerJens Axboe <axboe@kernel.dk>
Sat, 6 Apr 2019 17:09:13 +0000 (11:09 -0600)
commit3db87236cfb29f143028b91293a8aee01cf932e7
tree8d19f1148c17376e1448ffc8724af05591efdc3c
parent372be408447506c43cc1bede4261324ef66d8fb4
block: sed-opal: pass steps via argument rather than via opal_dev

The steps argument is only read by the next function, so it can
be passed directly as an argument rather than via opal_dev.

Normally, the steps is an array on the stack, so the pointer stops
being valid then the function that set opal_dev.steps returns.
If opal_dev.steps was not set to NULL before return it would become
a dangling pointer. When the steps are passed as argument this
becomes easier to see and more difficult to misuse.

Acked-by: Jon Derrick <jonathan.derrick@intel.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Scott Bauer <sbauer@plzdonthack.me>
Signed-off-by: David Kozub <zub@linux.fjfi.cvut.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/sed-opal.c