if (!ring->descriptors)
goto err_free_ring;
- if (nhi->ops && nhi->ops->request_ring_irq) {
+ if (nhi->ops->request_ring_irq) {
if (nhi->ops->request_ring_irq(ring, flags & RING_FLAG_NO_SUSPEND))
goto err_free_descs;
}
return ring;
err_release_msix:
- if (nhi->ops && nhi->ops->release_ring_irq)
+ if (nhi->ops->release_ring_irq)
nhi->ops->release_ring_irq(ring);
err_free_descs:
dma_free_coherent(ring->nhi->dev,
}
spin_unlock_irq(&ring->nhi->lock);
- if (nhi->ops && nhi->ops->release_ring_irq)
+ if (nhi->ops->release_ring_irq)
nhi->ops->release_ring_irq(ring);
dma_free_coherent(ring->nhi->dev,
if (ret)
return ret;
- if (nhi->ops && nhi->ops->suspend_noirq) {
+ if (nhi->ops->suspend_noirq) {
ret = nhi->ops->suspend_noirq(tb->nhi, wakeup);
if (ret)
return ret;
*/
if ((nhi->ops->is_present && !nhi->ops->is_present(nhi))) {
nhi->going_away = true;
- } else if (nhi->ops && nhi->ops->resume_noirq) {
+ } else if (nhi->ops->resume_noirq) {
ret = nhi->ops->resume_noirq(nhi);
if (ret)
return ret;
if (ret)
return ret;
- if (nhi->ops && nhi->ops->runtime_suspend) {
+ if (nhi->ops->runtime_suspend) {
ret = nhi->ops->runtime_suspend(tb->nhi);
if (ret)
return ret;
struct tb_nhi *nhi = tb->nhi;
int ret;
- if (nhi->ops && nhi->ops->runtime_resume) {
+ if (nhi->ops->runtime_resume) {
ret = nhi->ops->runtime_resume(nhi);
if (ret)
return ret;
}
nhi_disable_interrupts(nhi);
- if (nhi->ops && nhi->ops->shutdown)
+ if (nhi->ops->shutdown)
nhi->ops->shutdown(nhi);
}
struct tb *tb;
int res;
+ if (!nhi->ops)
+ return dev_err_probe(dev, -EINVAL, "NHI ops not set\n");
+
+ if (!nhi->ops->init_interrupts)
+ return dev_err_probe(dev, -EINVAL, "missing required NHI ops\n");
+
nhi->hop_count = ioread32(nhi->iobase + REG_CAPS) & 0x3ff;
dev_dbg(dev, "total paths: %d\n", nhi->hop_count);
/* In case someone left them on. */
nhi_disable_interrupts(nhi);
- if (nhi->ops && nhi->ops->init_interrupts) {
- res = nhi->ops->init_interrupts(nhi);
- if (res)
- return dev_err_probe(dev, res, "cannot enable interrupts, aborting\n");
- }
+ res = nhi->ops->init_interrupts(nhi);
+ if (res)
+ return dev_err_probe(dev, res, "cannot enable interrupts, aborting\n");
spin_lock_init(&nhi->lock);
if (res)
return dev_err_probe(dev, res, "failed to set DMA mask\n");
- if (nhi->ops && nhi->ops->init) {
+ if (nhi->ops->init) {
res = nhi->ops->init(nhi);
if (res)
return res;
sw->nvm->authenticating = true;
if (!tb_route(sw)) {
- if (nhi->ops && nhi->ops->pre_nvm_auth)
+ if (nhi->ops->pre_nvm_auth)
nhi->ops->pre_nvm_auth(nhi);
ret = nvm_authenticate_host_dma_port(sw);
} else {
nvm_get_auth_status(sw, &status);
if (status) {
if (!tb_route(sw)) {
- if (nhi->ops && nhi->ops->post_nvm_auth)
+ if (nhi->ops->post_nvm_auth)
nhi->ops->post_nvm_auth(nhi);
}
return 0;
/* Now we can allow root port to suspend again */
if (!tb_route(sw)) {
- if (nhi->ops && nhi->ops->post_nvm_auth)
+ if (nhi->ops->post_nvm_auth)
nhi->ops->post_nvm_auth(nhi);
}