提交 6f061487 编写于 作者: J Jay Fenlason 提交者: Stefan Richter

firewire: fw-sbp2: correctly dereference by container_of

Replace a cast with a container_of().  As long as nobody reorders the
structure elements, they do the same thing, but container_of() is more
readable.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (added complete_command_orb)
Acked-by: NKristian Høgsberg <krh@redhat.com>
上级 7ada60e3
......@@ -395,7 +395,7 @@ static void
complete_management_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
{
struct sbp2_management_orb *orb =
(struct sbp2_management_orb *)base_orb;
container_of(base_orb, struct sbp2_management_orb, base);
if (status)
memcpy(&orb->status, status, sizeof(*status));
......@@ -838,7 +838,8 @@ sbp2_status_to_sense_data(u8 *sbp2_status, u8 *sense_data)
static void
complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
{
struct sbp2_command_orb *orb = (struct sbp2_command_orb *)base_orb;
struct sbp2_command_orb *orb =
container_of(base_orb, struct sbp2_command_orb, base);
struct fw_unit *unit = orb->unit;
struct fw_device *device = fw_device(unit->device.parent);
struct scatterlist *sg;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册